Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
add: auto uncollapse CW on all notes option
Browse files Browse the repository at this point in the history
Closes #191
  • Loading branch information
Mar0xy committed Dec 3, 2023
1 parent aa4c3df commit 620be4a
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/components/MkNoteSimple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ 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;
expandAllCws?: boolean;
hideFiles?: boolean;
}>();

let showContent = $ref(false);
let showContent = $ref(defaultStore.state.uncollapseCW);

watch(() => props.expandAllCws, (expandAllCws) => {
if (expandAllCws !== showContent) showContent = expandAllCws;
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkNoteSub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/SkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/SkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/components/SkNoteSimple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ 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;
expandAllCws?: boolean;
hideFiles?: boolean;
}>();

let showContent = $ref(false);
let showContent = $ref(defaultStore.state.uncollapseCW);

watch(() => props.expandAllCws, (expandAllCws) => {
if (expandAllCws !== showContent) showContent = expandAllCws;
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/SkNoteSub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/pages/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -63,7 +64,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>Note Design</template>
<option value="sharkey">Sharkey</option>
<option value="misskey">Misskey</option>
</MkRadios>
</MkRadios>
</div>

<MkSelect v-model="instanceTicker">
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 620be4a

Please sign in to comment.