shoc-frontend-new/src/domain/work-orders/utils/comment-ownership.ts

11 lines
437 B
TypeScript

import type { WorkOrderComment } from "@/domain/work-orders/types/work-order-detail";
export function isOwnWorkOrderComment(
comment: WorkOrderComment,
currentUserId: string | number | null | undefined,
): boolean {
if (currentUserId == null || currentUserId === "") return false;
const authorId = comment.authorId;
if (authorId == null || authorId === "") return false;
return String(authorId) === String(currentUserId);
}