From 67d17ce194aa05875e17126b1a778febf48524bc Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Tue, 6 Jun 2023 23:41:59 +0200
Subject: [PATCH] Add `legal` as report category (#23941)

---
 app/javascript/mastodon/features/report/category.jsx | 4 ++++
 app/javascript/mastodon/locales/en.json              | 2 ++
 app/models/report.rb                                 | 1 +
 3 files changed, 7 insertions(+)

diff --git a/app/javascript/mastodon/features/report/category.jsx b/app/javascript/mastodon/features/report/category.jsx
index a6e817c73d..fb9e55c579 100644
--- a/app/javascript/mastodon/features/report/category.jsx
+++ b/app/javascript/mastodon/features/report/category.jsx
@@ -16,6 +16,8 @@ const messages = defineMessages({
   dislike_description: { id: 'report.reasons.dislike_description', defaultMessage: 'It is not something you want to see' },
   spam: { id: 'report.reasons.spam', defaultMessage: 'It\'s spam' },
   spam_description: { id: 'report.reasons.spam_description', defaultMessage: 'Malicious links, fake engagement, or repetitive replies' },
+  legal: { id: 'report.reasons.legal', defaultMessage: 'It\'s illegal' },
+  legal_description: { id: 'report.reasons.legal_description', defaultMessage: 'You believe it violates the law of your or the server\'s country' },
   violation: { id: 'report.reasons.violation', defaultMessage: 'It violates server rules' },
   violation_description: { id: 'report.reasons.violation_description', defaultMessage: 'You are aware that it breaks specific rules' },
   other: { id: 'report.reasons.other', defaultMessage: 'It\'s something else' },
@@ -69,11 +71,13 @@ class Category extends PureComponent {
     const options = rules.size > 0 ? [
       'dislike',
       'spam',
+      'legal',
       'violation',
       'other',
     ] : [
       'dislike',
       'spam',
+      'legal',
       'other',
     ];
 
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json
index e2bf747710..ef0964b192 100644
--- a/app/javascript/mastodon/locales/en.json
+++ b/app/javascript/mastodon/locales/en.json
@@ -532,6 +532,8 @@
   "report.placeholder": "Additional comments",
   "report.reasons.dislike": "I don't like it",
   "report.reasons.dislike_description": "It is not something you want to see",
+  "report.reasons.legal": "It's illegal",
+  "report.reasons.legal_description": "You believe it violates the law of your or the server's country",
   "report.reasons.other": "It's something else",
   "report.reasons.other_description": "The issue does not fit into other categories",
   "report.reasons.spam": "It's spam",
diff --git a/app/models/report.rb b/app/models/report.rb
index e738281adc..674cc9a279 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -51,6 +51,7 @@ class Report < ApplicationRecord
   enum category: {
     other: 0,
     spam: 1_000,
+    legal: 1_500,
     violation: 2_000,
   }
 
-- 
GitLab