Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/entity/SourcePostModeration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export enum WarningReason {
}

export type SourcePostModerationFlags = Partial<{
aiModerated: boolean;
vordr: boolean;
warningReason: WarningReason;
dedupKey: string;
Expand Down
13 changes: 12 additions & 1 deletion src/schema/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,10 @@ export const typeDefs = /* GraphQL */ `
Moderator message for the post
"""
moderatorMessage: String
"""
Whether this moderation decision was made by AI
"""
aiModerated: Boolean
): [SourcePostModeration]! @auth

"""
Expand Down Expand Up @@ -3120,12 +3124,13 @@ export const resolvers: IResolvers<unknown, BaseContext> = {
status,
rejectionReason = null,
moderatorMessage = null,
aiModerated = false,
}: {
postIds: string[];
} & Pick<
SourcePostModeration,
'sourceId' | 'status' | 'rejectionReason' | 'moderatorMessage'
>,
> & { aiModerated?: boolean },
ctx: AuthContext,
info,
) => {
Expand Down Expand Up @@ -3177,6 +3182,12 @@ export const resolvers: IResolvers<unknown, BaseContext> = {
update.moderatorMessage = moderatorMessage;
}

if (aiModerated) {
update.flags = updateFlagsStatement<SourcePostModeration>({
aiModerated: true,
});
}

await ctx.con
.getRepository(SourcePostModeration)
.update(
Expand Down
Loading