From 206e81da105c959290303d16fec9e123199fb46c Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sat, 2 Sep 2023 22:46:07 +0200 Subject: [PATCH] Add option to always expand CWs, resolves #137 --- locales/en-US.yml | 1 + packages/client/src/pages/note.vue | 3 ++- packages/client/src/pages/settings/general.vue | 6 ++++++ packages/client/src/store.ts | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 2bd9cfa2d..0636c7072 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -2135,3 +2135,4 @@ _cwStyle: modern: "Modern" classic: "Classic (Misskey/Foundkey-like)" alternative: "Alternative (Firefish-like)" +alwaysExpandCws: "Always expand posts with content warnings" diff --git a/packages/client/src/pages/note.vue b/packages/client/src/pages/note.vue index ff6bbfdb6..6e46df45b 100644 --- a/packages/client/src/pages/note.vue +++ b/packages/client/src/pages/note.vue @@ -47,6 +47,7 @@ import MkButton from "@/components/MkButton.vue"; import * as os from "@/os"; import { definePageMetadata } from "@/scripts/page-metadata"; import { i18n } from "@/i18n"; +import { defaultStore } from "@/store"; const props = defineProps<{ noteId: string; @@ -56,7 +57,7 @@ let note = $ref(); let error = $ref(); let isRenote = $ref(false); let appearNote = $ref(); -let expandAllCws = $ref(false); +let expandAllCws = $ref(defaultStore.state.alwaysExpandCws); const prevPagination = { endpoint: "users/notes" as const, diff --git a/packages/client/src/pages/settings/general.vue b/packages/client/src/pages/settings/general.vue index 4b9a2fa78..6c840771a 100644 --- a/packages/client/src/pages/settings/general.vue +++ b/packages/client/src/pages/settings/general.vue @@ -197,6 +197,9 @@ class="_formBlock" >{{ i18n.ts.showAdminUpdates }} + {{ + i18n.ts.alwaysExpandCws + }} @@ -331,6 +334,9 @@ const expandOnNoteClick = computed( const showFixedPostForm = computed( defaultStore.makeGetterSetter("showFixedPostForm"), ); +const alwaysExpandCws = computed( + defaultStore.makeGetterSetter("alwaysExpandCws"), +); const numberOfPageCache = computed( defaultStore.makeGetterSetter("numberOfPageCache"), ); diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index 38bf256ec..460453485 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -338,6 +338,10 @@ export const defaultStore = markRaw( where: "device", default: "modern" as "modern" | "classic" | "alternative", }, + alwaysExpandCws: { + where: "device", + default: false, + }, }), );