6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import type { Comment, CommentReply } from "@/contracts/types/chat-comments.types";
|
|
import type { Membership } from "@/contracts/types/members.types";
|
|
import type { CommentData } from "../comment-item/types";
|
|
import type { CommentThreadData } from "../comment-thread/types";
|
|
import type { MemberOption } from "../member-mention-picker/types";
|
|
|
|
export function transformAuthor(author: Comment["author"]): CommentData["author"] {
|
|
if (!author) return null;
|
|
return {
|
|
id: author.id,
|
|
displayName: author.display_name,
|
|
email: author.email,
|
|
avatarUrl: author.avatar_url,
|
|
};
|
|
}
|
|
|
|
export function transformReply(reply: CommentReply): CommentData {
|
|
return {
|
|
id: reply.id,
|
|
content: reply.content,
|
|
contentRendered: reply.content_rendered,
|
|
author: transformAuthor(reply.author),
|
|
createdAt: reply.created_at,
|
|
updatedAt: reply.updated_at,
|
|
isEdited: reply.is_edited,
|
|
canEdit: reply.can_edit,
|
|
canDelete: reply.can_delete,
|
|
};
|
|
}
|
|
|
|
export function transformComment(comment: Comment): CommentThreadData {
|
|
return {
|
|
id: comment.id,
|
|
messageId: comment.message_id,
|
|
content: comment.content,
|
|
contentRendered: comment.content_rendered,
|
|
author: transformAuthor(comment.author),
|
|
createdAt: comment.created_at,
|
|
updatedAt: comment.updated_at,
|
|
isEdited: comment.is_edited,
|
|
canEdit: comment.can_edit,
|
|
canDelete: comment.can_delete,
|
|
replyCount: comment.reply_count,
|
|
replies: comment.replies.map(transformReply),
|
|
};
|
|
}
|
|
|
|
export function transformMember(membership: Membership): MemberOption {
|
|
return {
|
|
id: membership.user_id,
|
|
displayName: membership.user_display_name ?? null,
|
|
email: membership.user_email ?? "",
|
|
avatarUrl: membership.user_avatar_url ?? null,
|
|
};
|
|
}
|