From 91bcefaeff888df66d36b06503133448bc2d4564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=AC=B4=EB=9D=BC=EC=BF=A0=EB=AA=A8?= Date: Sun, 21 Jul 2024 21:13:18 +0900 Subject: [PATCH] refactor(privateMode): move option to general tab and requires refresh --- packages/frontend/src/components/MkDrive.vue | 2 +- packages/frontend/src/components/MkNote.vue | 2 +- .../frontend/src/pages/settings/general.vue | 58 +++++++++++++++++++ .../frontend/src/pages/settings/privacy.vue | 52 ----------------- packages/frontend/src/pages/user/home.vue | 4 +- packages/frontend/src/store.ts | 2 +- 6 files changed, 63 insertions(+), 57 deletions(-) diff --git a/packages/frontend/src/components/MkDrive.vue b/packages/frontend/src/components/MkDrive.vue index ad9989e92..ed68510a7 100644 --- a/packages/frontend/src/components/MkDrive.vue +++ b/packages/frontend/src/components/MkDrive.vue @@ -152,7 +152,7 @@ const selectedFolders = ref([]); const uploadings = uploads; const connection = useStream().useChannel('drive'); const keepOriginal = ref(defaultStore.state.keepOriginalUploading); // 外部渡しが多いので$refは使わないほうがよい -const hideDriveFileList = ref(defaultStore.state.hideSensitiveInformation && defaultStore.state.hideDriveFileList); +const hideDriveFileList = ref(defaultStore.state.privateMode && defaultStore.state.hideDriveFileList); // ドロップされようとしているか const draghover = ref(false); diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index fb42e0aee..f2400aecc 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -269,7 +269,7 @@ const isDeleted = ref(false); const muted = ref(checkMute(appearNote.value, $i?.mutedWords ?? [])); const isRedacted = ref( defaultStore.state.hideDirectMessages && - defaultStore.state.hideSensitiveInformation && + defaultStore.state.privateMode && note.value.visibility === 'specified' ); const translation = ref(null); diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue index 64f838400..6351ef14e 100644 --- a/packages/frontend/src/pages/settings/general.vue +++ b/packages/frontend/src/pages/settings/general.vue @@ -216,6 +216,53 @@ SPDX-License-Identifier: AGPL-3.0-only + + + +
+ + {{ i18n.ts._hideSensitiveInformation.use }} + + + + + + + + {{ i18n.ts._hideSensitiveInformation.directMessagesUse }} + + + + + + + + + {{ i18n.ts._hideSensitiveInformation.driveUse }} + + + + + + + + + {{ i18n.ts._hideSensitiveInformation.moderationLogUse }} + + + + + + + + + {{ i18n.ts._hideSensitiveInformation.rolesUse }} + + + +
+
+ @@ -259,6 +306,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js'; import { miLocalStorage } from '@/local-storage.js'; import { globalEvents } from '@/events.js'; import { claimAchievement } from '@/scripts/achievements.js'; +import { $i } from '@/account.js'; const lang = ref(miLocalStorage.getItem('lang')); const fontSize = ref(miLocalStorage.getItem('fontSize')); @@ -322,6 +370,11 @@ const enableHorizontalSwipe = computed(defaultStore.makeGetterSetter('enableHori const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('useNativeUIForVideoAudioPlayer')); const alwaysConfirmFollow = computed(defaultStore.makeGetterSetter('alwaysConfirmFollow')); const sensitiveDoubleClickRequired = computed(defaultStore.makeGetterSetter('sensitiveDoubleClickRequired')); +const privateMode = computed(defaultStore.makeGetterSetter('privateMode')); +const hideDirectMessages = computed(defaultStore.makeGetterSetter('hideDirectMessages')); +const hideDriveFileList = computed(defaultStore.makeGetterSetter('hideDriveFileList')); +const hideModerationLog = computed(defaultStore.makeGetterSetter('hideModerationLog')); +const hideRoleList = computed(defaultStore.makeGetterSetter('hideRoleList')); watch(lang, () => { miLocalStorage.setItem('lang', lang.value as string); @@ -365,6 +418,11 @@ watch([ disableStreamingTimeline, enableSeasonalScreenEffect, alwaysConfirmFollow, + privateMode, + hideDirectMessages, + hideDriveFileList, + hideModerationLog, + hideRoleList, ], async () => { await reloadAsk(); }); diff --git a/packages/frontend/src/pages/settings/privacy.vue b/packages/frontend/src/pages/settings/privacy.vue index 67a8ecd5c..d50dcff3f 100644 --- a/packages/frontend/src/pages/settings/privacy.vue +++ b/packages/frontend/src/pages/settings/privacy.vue @@ -67,53 +67,6 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.keepCw }} - - - - -
- - {{ i18n.ts._hideSensitiveInformation.use }} - - - - - - - - {{ i18n.ts._hideSensitiveInformation.directMessagesUse }} - - - - - - - - - {{ i18n.ts._hideSensitiveInformation.driveUse }} - - - - - - - - - {{ i18n.ts._hideSensitiveInformation.moderationLogUse }} - - - - - - - - - {{ i18n.ts._hideSensitiveInformation.rolesUse }} - - - -
-
@@ -145,11 +98,6 @@ const defaultNoteVisibility = computed(defaultStore.makeGetterSetter('defaultNot const defaultNoteLocalOnly = computed(defaultStore.makeGetterSetter('defaultNoteLocalOnly')); const rememberNoteVisibility = computed(defaultStore.makeGetterSetter('rememberNoteVisibility')); const keepCw = computed(defaultStore.makeGetterSetter('keepCw')); -const hideSensitiveInformation = computed(defaultStore.makeGetterSetter('hideSensitiveInformation')); -const hideDirectMessages = computed(defaultStore.makeGetterSetter('hideDirectMessages')); -const hideDriveFileList = computed(defaultStore.makeGetterSetter('hideDriveFileList')); -const hideModerationLog = computed(defaultStore.makeGetterSetter('hideModerationLog')); -const hideRoleList = computed(defaultStore.makeGetterSetter('hideRoleList')); function save() { misskeyApi('i/update', { diff --git a/packages/frontend/src/pages/user/home.vue b/packages/frontend/src/pages/user/home.vue index c6338548d..5a43f6b30 100644 --- a/packages/frontend/src/pages/user/home.vue +++ b/packages/frontend/src/pages/user/home.vue @@ -255,8 +255,8 @@ const isEditingMemo = ref(false); const moderationNote = ref(props.user.moderationNote); const editModerationNote = ref(false); -const hideModerationNote = !iAmModerator || (defaultStore.state.hideSensitiveInformation && defaultStore.state.hideModerationLog); -const hideRoleList = defaultStore.state.hideSensitiveInformation && defaultStore.state.hideRoleList; +const hideModerationNote = !iAmModerator || (defaultStore.state.privateMode && defaultStore.state.hideModerationLog); +const hideRoleList = defaultStore.state.privateMode && defaultStore.state.hideRoleList; watch(moderationNote, async () => { await misskeyApi('admin/update-user-note', { userId: props.user.id, text: moderationNote.value }); diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 784c2b85d..80246153c 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -156,7 +156,7 @@ export const defaultStore = markRaw(new Storage('base', { where: 'deviceAccount', default: false, }, - hideSensitiveInformation: { + privateMode: { where: 'device', default: false, },