From 7dd296017b835771f9c8e9a39da1e8348938f7f2 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Sat, 5 Oct 2024 22:43:34 -0400 Subject: [PATCH] fix modlog and translations for "Mark as NSFW" --- locales/en-US.yml | 3 +++ locales/index.d.ts | 12 ++++++++++++ locales/ja-JP.yml | 3 +++ .../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(-) 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 { // 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 : @{{ log.info.fileUserUsername }}{{ log.info.fileUserHost ? '@' + log.info.fileUserHost : '' }} : {{ log.info.host }} : {{ log.info.host }} + : {{ log.info.host }} + : {{ log.info.host }} : {{ log.info.host }} : {{ log.info.host }} : {{ log.info.announcement.title }} 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 {{ i18n.ts._delivery.resume }} {{ i18n.ts.blockThisInstance }} {{ i18n.ts.silenceThisInstance }} - Mark as NSFW + {{ i18n.ts.markInstanceAsNSFW }} {{ i18n.ts.rejectReports }} {{ i18n.ts.mediaSilenceThisInstance }} Refresh metadata