Skip to content

Commit

Permalink
Merge pull request #41 from planetary-social/add-missing-p
Browse files Browse the repository at this point in the history
Add missing p tag
  • Loading branch information
dcadenas authored Apr 4, 2024
2 parents 6ffbcb8 + 5b2f70e commit dd27d49
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 40 deletions.
5 changes: 5 additions & 0 deletions src/lib/nostr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);

Expand Down
80 changes: 40 additions & 40 deletions src/lib/openAICategories.js
Original file line number Diff line number Diff line change
@@ -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",
},
};

Expand Down
1 change: 1 addition & 0 deletions src/lib/slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default class Slack {

elements.unshift({
type: "button",
style: "danger",
text: {
type: "plain_text",
text: "Skip",
Expand Down
4 changes: 4 additions & 0 deletions test/moderationFunction.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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],
Expand Down
1 change: 1 addition & 0 deletions test/slack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ describe("Slack", () => {
elements: [
{
type: "button",
style: "danger",
text: {
type: "plain_text",
text: "Skip",
Expand Down

0 comments on commit dd27d49

Please sign in to comment.