From 4da0d4be7171f11e3a30ade275b764b8335e40e0 Mon Sep 17 00:00:00 2001
From: Hazel K <acomputerdog@gmail.com>
Date: Sat, 5 Oct 2024 22:01:55 -0400
Subject: add option to reject reports from an instance

---
 packages/frontend/src/pages/admin/modlog.ModLog.vue | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'packages/frontend/src/pages/admin/modlog.ModLog.vue')

diff --git a/packages/frontend/src/pages/admin/modlog.ModLog.vue b/packages/frontend/src/pages/admin/modlog.ModLog.vue
index f6f276de53..63e04e5bdd 100644
--- a/packages/frontend/src/pages/admin/modlog.ModLog.vue
+++ b/packages/frontend/src/pages/admin/modlog.ModLog.vue
@@ -23,6 +23,8 @@ SPDX-License-Identifier: AGPL-3.0-only
 					'markSensitiveDriveFile',
 					'resetPassword',
 					'suspendRemoteInstance',
+					'rejectRemoteInstanceReports',
+					'acceptRemoteInstanceReports',
 				].includes(log.type),
 				[$style.logRed]: [
 					'suspend',
@@ -61,6 +63,8 @@ SPDX-License-Identifier: AGPL-3.0-only
 		<span v-else-if="log.type === 'unmarkSensitiveDriveFile'">: @{{ log.info.fileUserUsername }}{{ log.info.fileUserHost ? '@' + log.info.fileUserHost : '' }}</span>
 		<span v-else-if="log.type === 'suspendRemoteInstance'">: {{ log.info.host }}</span>
 		<span v-else-if="log.type === 'unsuspendRemoteInstance'">: {{ log.info.host }}</span>
+		<span v-else-if="log.type === 'rejectRemoteInstanceReports'">: {{ log.info.host }}</span>
+		<span v-else-if="log.type === 'acceptRemoteInstanceReports'">: {{ log.info.host }}</span>
 		<span v-else-if="log.type === 'createGlobalAnnouncement'">: {{ log.info.announcement.title }}</span>
 		<span v-else-if="log.type === 'updateGlobalAnnouncement'">: {{ log.info.before.title }}</span>
 		<span v-else-if="log.type === 'deleteGlobalAnnouncement'">: {{ log.info.announcement.title }}</span>
-- 
cgit v1.2.3-freya


From 7dd296017b835771f9c8e9a39da1e8348938f7f2 Mon Sep 17 00:00:00 2001
From: Hazel K <acomputerdog@gmail.com>
Date: Sat, 5 Oct 2024 22:43:34 -0400
Subject: fix modlog and translations for "Mark as NSFW"

---
 locales/en-US.yml                                            |  3 +++
 locales/index.d.ts                                           | 12 ++++++++++++
 locales/ja-JP.yml                                            |  3 +++
 .../server/api/endpoints/admin/federation/update-instance.ts |  8 ++++++++
 packages/backend/src/types.ts                                | 10 ++++++++++
 packages/frontend/src/pages/admin/modlog.ModLog.vue          |  4 ++++
 packages/frontend/src/pages/instance-info.vue                |  2 +-
 7 files changed, 41 insertions(+), 1 deletion(-)

(limited to 'packages/frontend/src/pages/admin/modlog.ModLog.vue')

diff --git a/locales/en-US.yml b/locales/en-US.yml
index b4d08b73ee..dfd236b9c5 100644
--- a/locales/en-US.yml
+++ b/locales/en-US.yml
@@ -149,6 +149,7 @@ renoteUnmute: "Unmute Boosts"
 block: "Block"
 unblock: "Unblock"
 markAsNSFW: "Mark all media from user as NSFW"
+markInstanceAsNSFW: "Mark as NSFW"
 suspend: "Suspend"
 unsuspend: "Unsuspend"
 blockConfirm: "Are you sure that you want to block this account?"
@@ -2573,6 +2574,8 @@ _moderationLogTypes:
   resetPassword: "Password reset"
   suspendRemoteInstance: "Remote instance suspended"
   unsuspendRemoteInstance: "Remote instance unsuspended"
+  setRemoteInstanceNSFW: "Set remote instance as NSFW"
+  unsetRemoteInstanceNSFW: "Set remote instance as NSFW"
   rejectRemoteInstanceReports: "Rejected reports from remote instance"
   acceptRemoteInstanceReports: "Accepted reports from remote instance"
   updateRemoteInstanceNote: "Moderation note updated for remote instance."
diff --git a/locales/index.d.ts b/locales/index.d.ts
index c796174ac8..fb8d9339fc 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -612,6 +612,10 @@ export interface Locale extends ILocale {
      * ユーザーのすべてのメディアをNSFWとしてマークする
      */
     "markAsNSFW": string;
+    /**
+     * Mark as NSFW
+     */
+    "markInstanceAsNSFW": string;
     /**
      * 凍結
      */
@@ -9980,6 +9984,14 @@ export interface Locale extends ILocale {
          * リモートサーバーを再開
          */
         "unsuspendRemoteInstance": string;
+        /**
+         * Set remote instance as NSFW
+         */
+        "setRemoteInstanceNSFW": string;
+        /**
+         * Set remote instance as NSFW
+         */
+        "unsetRemoteInstanceNSFW": string;
         /**
          * Rejected reports from remote instance
          */
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 36e74e8167..d86b7a73d1 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -149,6 +149,7 @@ renoteUnmute: "ブーストのミュートを解除"
 block: "ブロック"
 unblock: "ブロック解除"
 markAsNSFW: "ユーザーのすべてのメディアをNSFWとしてマークする"
+markInstanceAsNSFW: "Mark as NSFW"
 suspend: "凍結"
 unsuspend: "解凍"
 blockConfirm: "ブロックしますか？"
@@ -2641,6 +2642,8 @@ _moderationLogTypes:
   resetPassword: "パスワードをリセット"
   suspendRemoteInstance: "リモートサーバーを停止"
   unsuspendRemoteInstance: "リモートサーバーを再開"
+  setRemoteInstanceNSFW: "Set remote instance as NSFW"
+  unsetRemoteInstanceNSFW: "Set remote instance as NSFW"
   rejectRemoteInstanceReports: "Rejected reports from remote instance"
   acceptRemoteInstanceReports: "Accepted reports from remote instance"
   updateRemoteInstanceNote: "リモートサーバーのモデレーションノート更新"
diff --git a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts
index 0d62417299..daf19c4435 100644
--- a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts
+++ b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts
@@ -76,6 +76,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 				}
 			}
 
+			if (ps.isNSFW != null && instance.isNSFW !== ps.isNSFW) {
+				const message = ps.rejectReports ? 'setRemoteInstanceNSFW' : 'unsetRemoteInstanceNSFW';
+				this.moderationLogService.log(me, message, {
+					id: instance.id,
+					host: instance.host,
+				});
+			}
+
 			if (ps.rejectReports != null && instance.rejectReports !== ps.rejectReports) {
 				const message = ps.rejectReports ? 'rejectRemoteInstanceReports' : 'acceptRemoteInstanceReports';
 				this.moderationLogService.log(me, message, {
diff --git a/packages/backend/src/types.ts b/packages/backend/src/types.ts
index b3c3275b24..d64d72c07f 100644
--- a/packages/backend/src/types.ts
+++ b/packages/backend/src/types.ts
@@ -77,6 +77,8 @@ export const moderationLogTypes = [
 	'deleteGlobalAnnouncement',
 	'deleteUserAnnouncement',
 	'resetPassword',
+	'setRemoteInstanceNSFW',
+	'unsetRemoteInstanceNSFW',
 	'suspendRemoteInstance',
 	'unsuspendRemoteInstance',
 	'rejectRemoteInstanceReports',
@@ -229,6 +231,14 @@ export type ModerationLogPayloads = {
 		userUsername: string;
 		userHost: string | null;
 	};
+	setRemoteInstanceNSFW: {
+		id: string;
+		host: string;
+	};
+	unsetRemoteInstanceNSFW: {
+		id: string;
+		host: string;
+	};
 	suspendRemoteInstance: {
 		id: string;
 		host: string;
diff --git a/packages/frontend/src/pages/admin/modlog.ModLog.vue b/packages/frontend/src/pages/admin/modlog.ModLog.vue
index 63e04e5bdd..9fe804b2bd 100644
--- a/packages/frontend/src/pages/admin/modlog.ModLog.vue
+++ b/packages/frontend/src/pages/admin/modlog.ModLog.vue
@@ -23,6 +23,8 @@ SPDX-License-Identifier: AGPL-3.0-only
 					'markSensitiveDriveFile',
 					'resetPassword',
 					'suspendRemoteInstance',
+					'setRemoteInstanceNSFW',
+					'unsetRemoteInstanceNSFW',
 					'rejectRemoteInstanceReports',
 					'acceptRemoteInstanceReports',
 				].includes(log.type),
@@ -63,6 +65,8 @@ SPDX-License-Identifier: AGPL-3.0-only
 		<span v-else-if="log.type === 'unmarkSensitiveDriveFile'">: @{{ log.info.fileUserUsername }}{{ log.info.fileUserHost ? '@' + log.info.fileUserHost : '' }}</span>
 		<span v-else-if="log.type === 'suspendRemoteInstance'">: {{ log.info.host }}</span>
 		<span v-else-if="log.type === 'unsuspendRemoteInstance'">: {{ log.info.host }}</span>
+		<span v-else-if="log.type === 'setRemoteInstanceNSFW'">: {{ log.info.host }}</span>
+		<span v-else-if="log.type === 'unsetRemoteInstanceNSFW'">: {{ log.info.host }}</span>
 		<span v-else-if="log.type === 'rejectRemoteInstanceReports'">: {{ log.info.host }}</span>
 		<span v-else-if="log.type === 'acceptRemoteInstanceReports'">: {{ log.info.host }}</span>
 		<span v-else-if="log.type === 'createGlobalAnnouncement'">: {{ log.info.announcement.title }}</span>
diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue
index f5cc37a490..b5803ab3f1 100644
--- a/packages/frontend/src/pages/instance-info.vue
+++ b/packages/frontend/src/pages/instance-info.vue
@@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only
 						<MkButton v-if="suspensionState !== 'none'" :disabled="!instance" @click="resumeDelivery">{{ i18n.ts._delivery.resume }}</MkButton>
 						<MkSwitch v-model="isBlocked" :disabled="!meta || !instance" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch>
 						<MkSwitch v-model="isSilenced" :disabled="!meta || !instance" @update:modelValue="toggleSilenced">{{ i18n.ts.silenceThisInstance }}</MkSwitch>
-						<MkSwitch v-model="isNSFW" :disabled="!instance" @update:modelValue="toggleNSFW">Mark as NSFW</MkSwitch>
+						<MkSwitch v-model="isNSFW" :disabled="!instance" @update:modelValue="toggleNSFW">{{ i18n.ts.markInstanceAsNSFW }}</MkSwitch>
 						<MkSwitch v-model="rejectReports" :disabled="!instance" @update:modelValue="toggleRejectReports">{{ i18n.ts.rejectReports }}</MkSwitch>
 						<MkSwitch v-model="isMediaSilenced" :disabled="!meta || !instance" @update:modelValue="toggleMediaSilenced">{{ i18n.ts.mediaSilenceThisInstance }}</MkSwitch>
 						<MkButton @click="refreshMetadata"><i class="ti ti-refresh"></i> Refresh metadata</MkButton>
-- 
cgit v1.2.3-freya

