From e5667913f709c26b0f43412d947e23c62e85ad16 Mon Sep 17 00:00:00 2001
From: Mar0xy <marie@kaifa.ch>
Date: Sun, 3 Dec 2023 20:08:21 +0100
Subject: [PATCH] add: expand all long notes option

---
 packages/frontend/src/components/MkNote.vue           | 2 +-
 packages/frontend/src/components/MkSubNoteContent.vue | 2 +-
 packages/frontend/src/components/SkNote.vue           | 2 +-
 packages/frontend/src/store.ts                        | 4 ++++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue
index bfc03cff7b..e17f4b355a 100644
--- a/packages/frontend/src/components/MkNote.vue
+++ b/packages/frontend/src/components/MkNote.vue
@@ -277,7 +277,7 @@ const urls = $computed(() => parsed ? extractUrlFromMfm(parsed).filter(u => u !=
 const animated = $computed(() => parsed ? checkAnimationFromMfm(parsed) : null);
 const allowAnim = ref(defaultStore.state.advancedMfm && defaultStore.state.animatedMfm ? true : false);
 const isLong = shouldCollapsed(appearNote, urls ?? []);
-const collapsed = ref(appearNote.cw == null && isLong);
+const collapsed = defaultStore.state.expandLongNote && appearNote.cw == null ? false : ref(appearNote.cw == null && isLong);
 const isDeleted = ref(false);
 const renoted = ref(false);
 const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);
diff --git a/packages/frontend/src/components/MkSubNoteContent.vue b/packages/frontend/src/components/MkSubNoteContent.vue
index 8a306d172f..abad074515 100644
--- a/packages/frontend/src/components/MkSubNoteContent.vue
+++ b/packages/frontend/src/components/MkSubNoteContent.vue
@@ -73,7 +73,7 @@ const parsed = $computed(() => props.note.text ? mfm.parse(props.note.text) : nu
 const animated = $computed(() => parsed ? checkAnimationFromMfm(parsed) : null);
 let allowAnim = $ref(defaultStore.state.advancedMfm && defaultStore.state.animatedMfm ? true : false);
 
-const isLong = shouldCollapsed(props.note, []);
+const isLong = defaultStore.state.expandLongNote && !props.hideFiles ? false : shouldCollapsed(props.note, []);
 
 function animatedMFM() {
 	if (allowAnim) {
diff --git a/packages/frontend/src/components/SkNote.vue b/packages/frontend/src/components/SkNote.vue
index 0a48173ac6..349304db45 100644
--- a/packages/frontend/src/components/SkNote.vue
+++ b/packages/frontend/src/components/SkNote.vue
@@ -278,7 +278,7 @@ const urls = $computed(() => parsed ? extractUrlFromMfm(parsed).filter(u => u !=
 const animated = $computed(() => parsed ? checkAnimationFromMfm(parsed) : null);
 const allowAnim = ref(defaultStore.state.advancedMfm && defaultStore.state.animatedMfm ? true : false);
 const isLong = shouldCollapsed(appearNote, urls ?? []);
-const collapsed = ref(appearNote.cw == null && isLong);
+const collapsed = defaultStore.state.expandLongNote && appearNote.cw == null ? false : ref(appearNote.cw == null && isLong);
 const isDeleted = ref(false);
 const renoted = ref(false);
 const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);
diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts
index 1863995bc1..eb16222968 100644
--- a/packages/frontend/src/store.ts
+++ b/packages/frontend/src/store.ts
@@ -78,6 +78,10 @@ export const defaultStore = markRaw(new Storage('base', {
 		where: 'account',
 		default: false,
 	},
+	expandLongNote: {
+		where: 'device',
+		default: false,
+	},
 	rememberNoteVisibility: {
 		where: 'account',
 		default: false,
-- 
GitLab