mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
18 lines
811 B
TypeScript
18 lines
811 B
TypeScript
export const approvePendingCommentModeration = { approved: true } as const;
|
|
|
|
// pkc-js clears pendingApproval only when rejection is published as approved:false.
|
|
// Sending removed:true marks the comment removed but can leave it in the mod queue.
|
|
export const rejectPendingCommentModeration = { approved: false } as const;
|
|
|
|
type PendingApprovalDisplayState = {
|
|
approved?: boolean;
|
|
removed?: boolean;
|
|
pendingApproval?: boolean;
|
|
};
|
|
|
|
export const isPendingApprovalRejected = (comment?: PendingApprovalDisplayState) =>
|
|
comment?.removed === true || (comment?.pendingApproval === true && comment?.approved === false);
|
|
|
|
export const isPendingApprovalAwaiting = (comment?: PendingApprovalDisplayState) =>
|
|
comment?.pendingApproval === true && comment?.approved !== true && !isPendingApprovalRejected(comment);
|