Make deleted-comment cleanup atomic
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -34,6 +34,7 @@ import {
|
||||
} from "@paperclipai/db";
|
||||
import type {
|
||||
AcceptedPlanDecomposition,
|
||||
IssueComment,
|
||||
IssueCommentAuthorType,
|
||||
IssueCommentMetadata,
|
||||
IssueCommentPresentation,
|
||||
@@ -5733,6 +5734,9 @@ export function issueService(db: Db) {
|
||||
userId?: string | null;
|
||||
runId?: string | null;
|
||||
},
|
||||
options?: {
|
||||
afterTombstone?: (comment: IssueComment, tx: any) => Promise<void>;
|
||||
},
|
||||
) => {
|
||||
const currentUserRedactionOptions = {
|
||||
enabled: (await instanceSettings.getGeneral()).censorUsernameInLogs,
|
||||
@@ -5763,7 +5767,10 @@ export function issueService(db: Db) {
|
||||
.set({ updatedAt: now })
|
||||
.where(eq(issues.id, comment.issueId));
|
||||
|
||||
return redactIssueComment(comment, currentUserRedactionOptions.enabled);
|
||||
const redacted = redactIssueComment(comment, currentUserRedactionOptions.enabled);
|
||||
await options?.afterTombstone?.(redacted, tx);
|
||||
|
||||
return redacted;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user