add: auto uncollapse CW on all notes option

Closes transfem-org/Sharkey#191
This commit is contained in:
Mar0xy 2023-12-03 19:35:39 +01:00
parent aa4c3dfffe
commit 620be4a9e1
No known key found for this signature in database
GPG Key ID: 56569BBE47D2C828
10 changed files with 17 additions and 9 deletions

View File

@ -271,7 +271,7 @@ const renoteUrl = appearNote.renote ? appearNote.renote.url : null;
const renoteUri = appearNote.renote ? appearNote.renote.uri : null;
const isMyRenote = $i && ($i.id === note.userId);
const showContent = ref(false);
const showContent = ref(defaultStore.state.uncollapseCW);
const parsed = $computed(() => appearNote.text ? mfm.parse(appearNote.text) : null);
const urls = $computed(() => parsed ? extractUrlFromMfm(parsed).filter(u => u !== renoteUrl && u !== renoteUri) : null);
const animated = $computed(() => parsed ? checkAnimationFromMfm(parsed) : null);

View File

@ -306,7 +306,7 @@ const renoteUrl = appearNote.renote ? appearNote.renote.url : null;
const renoteUri = appearNote.renote ? appearNote.renote.uri : null;
const isMyRenote = $i && ($i.id === note.userId);
const showContent = ref(false);
const showContent = ref(defaultStore.state.uncollapseCW);
const isDeleted = ref(false);
const renoted = ref(false);
const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);

View File

@ -28,6 +28,7 @@ import MkNoteHeader from '@/components/MkNoteHeader.vue';
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
import MkCwButton from '@/components/MkCwButton.vue';
import { $i } from '@/account.js';
import { defaultStore } from '@/store.js';
const props = defineProps<{
note: Misskey.entities.Note;
@ -35,7 +36,7 @@ const props = defineProps<{
hideFiles?: boolean;
}>();
let showContent = $ref(false);
let showContent = $ref(defaultStore.state.uncollapseCW);
watch(() => props.expandAllCws, (expandAllCws) => {
if (expandAllCws !== showContent) showContent = expandAllCws;

View File

@ -244,7 +244,7 @@ function undoRenote() : void {
}
}
let showContent = $ref(false);
let showContent = $ref(defaultStore.state.uncollapseCW);
watch(() => props.expandAllCws, (expandAllCws) => {
if (expandAllCws !== showContent) showContent = expandAllCws;

View File

@ -272,7 +272,7 @@ const renoteUrl = appearNote.renote ? appearNote.renote.url : null;
const renoteUri = appearNote.renote ? appearNote.renote.uri : null;
const isMyRenote = $i && ($i.id === note.userId);
const showContent = ref(false);
const showContent = ref(defaultStore.state.uncollapseCW);
const parsed = $computed(() => appearNote.text ? mfm.parse(appearNote.text) : null);
const urls = $computed(() => parsed ? extractUrlFromMfm(parsed).filter(u => u !== renoteUrl && u !== renoteUri) : null);
const animated = $computed(() => parsed ? checkAnimationFromMfm(parsed) : null);

View File

@ -314,7 +314,7 @@ const renoteUrl = appearNote.renote ? appearNote.renote.url : null;
const renoteUri = appearNote.renote ? appearNote.renote.uri : null;
const isMyRenote = $i && ($i.id === note.userId);
const showContent = ref(false);
const showContent = ref(defaultStore.state.uncollapseCW);
const isDeleted = ref(false);
const renoted = ref(false);
const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);

View File

@ -28,6 +28,7 @@ import MkNoteHeader from '@/components/MkNoteHeader.vue';
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
import MkCwButton from '@/components/MkCwButton.vue';
import { $i } from '@/account.js';
import { defaultStore } from '@/store.js';
const props = defineProps<{
note: Misskey.entities.Note;
@ -35,7 +36,7 @@ const props = defineProps<{
hideFiles?: boolean;
}>();
let showContent = $ref(false);
let showContent = $ref(defaultStore.state.uncollapseCW);
watch(() => props.expandAllCws, (expandAllCws) => {
if (expandAllCws !== showContent) showContent = expandAllCws;

View File

@ -253,7 +253,7 @@ function undoRenote() : void {
}
}
let showContent = $ref(false);
let showContent = $ref(defaultStore.state.uncollapseCW);
watch(() => props.expandAllCws, (expandAllCws) => {
if (expandAllCws !== showContent) showContent = expandAllCws;

View File

@ -47,6 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="showClipButtonInNoteFooter">{{ i18n.ts.showClipButtonInNoteFooter }}</MkSwitch>
<MkSwitch v-model="collapseRenotes">{{ i18n.ts.collapseRenotes }}</MkSwitch>
<MkSwitch v-model="collapseFiles">{{ i18n.ts.collapseFiles }}</MkSwitch>
<MkSwitch v-model="uncollapseCW">Uncollapse CWs on notes</MkSwitch>
<MkSwitch v-model="autoloadConversation">{{ i18n.ts.autoloadConversation }}</MkSwitch>
<MkSwitch v-model="advancedMfm">{{ i18n.ts.enableAdvancedMfm }}</MkSwitch>
<MkSwitch v-if="advancedMfm" v-model="animatedMfm">{{ i18n.ts.enableAnimatedMfm }}</MkSwitch>
@ -279,6 +280,7 @@ const disableStreamingTimeline = computed(defaultStore.makeGetterSetter('disable
const useGroupedNotifications = computed(defaultStore.makeGetterSetter('useGroupedNotifications'));
const showTickerOnReplies = computed(defaultStore.makeGetterSetter('showTickerOnReplies'));
const noteDesign = computed(defaultStore.makeGetterSetter('noteDesign'));
const uncollapseCW = computed(defaultStore.makeGetterSetter('uncollapseCW'));
watch(lang, () => {
miLocalStorage.setItem('lang', lang.value as string);

View File

@ -74,6 +74,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'account',
default: false,
},
uncollapseCW: {
where: 'account',
default: false,
},
rememberNoteVisibility: {
where: 'account',
default: false,