diff --git a/src/lib/nostr.js b/src/lib/nostr.js index 3b2ab40..0308c1c 100644 --- a/src/lib/nostr.js +++ b/src/lib/nostr.js @@ -111,6 +111,11 @@ export default class Nostr { static async setTags(moderationNostrEvent, moderatedNostrEvent, moderation) { const reportType = this.inferReportType(moderation); + moderationNostrEvent.tags.push([ + "p", + moderatedNostrEvent.pubkey, + reportType, + ]); moderationNostrEvent.tags.push(["e", moderatedNostrEvent.id, reportType]); moderationNostrEvent.tags.push(["L", "MOD"]); diff --git a/src/lib/openAICategories.js b/src/lib/openAICategories.js index 8f28384..db44e98 100644 --- a/src/lib/openAICategories.js +++ b/src/lib/openAICategories.js @@ -1,68 +1,68 @@ const OPENAI_CATEGORIES = { hate: { description: - 'Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment.', - nip56_report_type: 'other', - nip69: 'IH', + "Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment.", + nip56_report_type: "other", + nip69: "IH", }, - 'hate/threatening': { + "hate/threatening": { description: - 'Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste.', - nip56_report_type: 'other', - nip69: 'HC-bhd', + "Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste.", + nip56_report_type: "other", + nip69: "HC-bhd", }, harassment: { description: - 'Content that expresses, incites, or promotes harassing language towards any target.', - nip56_report_type: 'other', - nip69: 'IL-har', + "Content that expresses, incites, or promotes harassing language towards any target.", + nip56_report_type: "other", + nip69: "IL-har", }, - 'harassment/threatening': { + "harassment/threatening": { description: - 'Harassment content that also includes violence or serious harm towards any target.', - nip56_report_type: 'other', - nip69: 'HC-bhd', + "Harassment content that also includes violence or serious harm towards any target.", + nip56_report_type: "other", + nip69: "HC-bhd", }, - 'self-harm': { + "self-harm": { description: - 'Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders.', - nip56_report_type: 'other', - nip69: 'HC-bhd', + "Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders.", + nip56_report_type: "other", + nip69: "HC-bhd", }, - 'self-harm/intent': { + "self-harm/intent": { description: - 'Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders.', - nip56_report_type: 'other', - nip69: 'HC-bhd', + "Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders.", + nip56_report_type: "other", + nip69: "HC-bhd", }, - 'self-harm/instructions': { + "self-harm/instructions": { description: - 'Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts.', - nip56_report_type: 'other', - nip69: 'HC-bhd', + "Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts.", + nip56_report_type: "other", + nip69: "HC-bhd", }, sexual: { description: - 'Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness).', - nip56_report_type: 'nudity', - nip69: 'NS', + "Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness).", + nip56_report_type: "nudity", + nip69: "NS", }, - 'sexual/minors': { + "sexual/minors": { description: - 'Sexual content that includes an individual who is under 18 years old.', - nip56_report_type: 'illegal', - nip69: 'IL-csa', + "Sexual content that includes an individual who is under 18 years old.", + nip56_report_type: "illegal", + nip69: "IL-csa", }, violence: { - description: 'Content that depicts death, violence, or physical injury.', - nip56_report_type: 'other', - nip69: 'VI', + description: "Content that depicts death, violence, or physical injury.", + nip56_report_type: "other", + nip69: "VI", }, - 'violence/graphic': { + "violence/graphic": { description: - 'Content that depicts death, violence, or physical injury in graphic detail.', - nip56_report_type: 'other', - nip69: 'VI', + "Content that depicts death, violence, or physical injury in graphic detail.", + nip56_report_type: "other", + nip69: "VI", }, }; diff --git a/src/lib/slack.js b/src/lib/slack.js index 3716351..a4a18e1 100644 --- a/src/lib/slack.js +++ b/src/lib/slack.js @@ -53,6 +53,7 @@ export default class Slack { elements.unshift({ type: "button", + style: "danger", text: { type: "plain_text", text: "Skip", diff --git a/test/moderationFunction.test.js b/test/moderationFunction.test.js index ae7b04e..69c4ece 100644 --- a/test/moderationFunction.test.js +++ b/test/moderationFunction.test.js @@ -231,6 +231,7 @@ describe("Moderation Cloud Function", async () => { sinon.assert.calledWithMatch(Nostr.publishNostrEvent, { kind: 1984, tags: [ + ["p", flaggedNostrEvent.pubkey, "other"], ["e", flaggedNostrEvent.id, "other"], ["L", "MOD"], ["l", "MOD>IH", "MOD", sinon.match.string], @@ -295,6 +296,7 @@ describe("Moderation Cloud Function", async () => { sinon.assert.calledWithMatch(Nostr.publishNostrEvent, { kind: 1984, tags: [ + ["p", flaggedNostrEvent.pubkey, "other"], ["e", flaggedNostrEvent.id, "other"], ["L", "MOD"], ["l", "MOD>IH", "MOD", sinon.match.string], @@ -364,6 +366,7 @@ describe("Moderation Cloud Function", async () => { sinon.assert.calledWithMatch(Nostr.publishNostrEvent, { kind: 1984, tags: [ + ["p", flaggedNostrEvent.pubkey, "other"], ["e", flaggedNostrEvent.id, "other"], ["L", "MOD"], ["l", "MOD>IH", "MOD", sinon.match.string], @@ -430,6 +433,7 @@ describe("Moderation Cloud Function", async () => { sinon.assert.calledWithMatch(Nostr.publishNostrEvent, { kind: 1984, tags: [ + ["p", flaggedNostrEvent.pubkey, "other"], ["e", flaggedNostrEvent.id, "other"], ["L", "MOD"], ["l", "MOD>IH", "MOD", sinon.match.string], diff --git a/test/slack.test.js b/test/slack.test.js index 4f1572c..e8c9e08 100644 --- a/test/slack.test.js +++ b/test/slack.test.js @@ -125,6 +125,7 @@ describe("Slack", () => { elements: [ { type: "button", + style: "danger", text: { type: "plain_text", text: "Skip",