upd: add option for reply depth

This commit is contained in:
ShittyKopper 2023-12-07 16:54:31 +03:00 committed by dakkar
parent 107cbac914
commit 05166f79e1
8 changed files with 23 additions and 4 deletions

View File

@ -944,6 +944,8 @@ approvalStatus: "Approval Status"
document: "Documentation" document: "Documentation"
numberOfPageCache: "Number of cached pages" numberOfPageCache: "Number of cached pages"
numberOfPageCacheDescription: "Increasing this number will improve convenience for but cause more load as more memory usage on the user's device." numberOfPageCacheDescription: "Increasing this number will improve convenience for but cause more load as more memory usage on the user's device."
numberOfReplies: "Number of replies in a thread"
numberOfRepliesDescription: "Increasing this number will display more replies. Setting this too high can cause replies to be cramped and unreadable."
logoutConfirm: "Really log out?" logoutConfirm: "Really log out?"
lastActiveDate: "Last used at" lastActiveDate: "Last used at"
statusbar: "Status bar" statusbar: "Status bar"

2
locales/index.d.ts vendored
View File

@ -947,6 +947,8 @@ export interface Locale {
"document": string; "document": string;
"numberOfPageCache": string; "numberOfPageCache": string;
"numberOfPageCacheDescription": string; "numberOfPageCacheDescription": string;
"numberOfReplies": string;
"numberOfRepliesDescription": string;
"logoutConfirm": string; "logoutConfirm": string;
"lastActiveDate": string; "lastActiveDate": string;
"statusbar": string; "statusbar": string;

View File

@ -944,6 +944,8 @@ approvalStatus: "承認状況"
document: "ドキュメント" document: "ドキュメント"
numberOfPageCache: "ページキャッシュ数" numberOfPageCache: "ページキャッシュ数"
numberOfPageCacheDescription: "多くすると利便性が向上しますが、負荷とメモリ使用量が増えます。" numberOfPageCacheDescription: "多くすると利便性が向上しますが、負荷とメモリ使用量が増えます。"
numberOfReplies: ""
numberOfRepliesDescription: ""
logoutConfirm: "ログアウトしますか?" logoutConfirm: "ログアウトしますか?"
lastActiveDate: "最終利用日時" lastActiveDate: "最終利用日時"
statusbar: "ステータスバー" statusbar: "ステータスバー"

View File

@ -64,7 +64,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</footer> </footer>
</div> </div>
</div> </div>
<template v-if="depth < 5"> <template v-if="depth < numberOfReplies">
<MkNoteSub v-for="reply in replies" :key="reply.id" :note="reply" :class="$style.reply" :detail="true" :depth="depth + 1" :expandAllCws="props.expandAllCws"/> <MkNoteSub v-for="reply in replies" :key="reply.id" :note="reply" :class="$style.reply" :detail="true" :depth="depth + 1" :expandAllCws="props.expandAllCws"/>
</template> </template>
<div v-else :class="$style.more"> <div v-else :class="$style.more">
@ -124,6 +124,7 @@ const translation = ref<any>(null);
const translating = ref(false); const translating = ref(false);
const isDeleted = ref(false); const isDeleted = ref(false);
const renoted = ref(false); const renoted = ref(false);
const numberOfReplies = ref(defaultStore.state.numberOfReplies);
const reactButton = shallowRef<HTMLElement>(); const reactButton = shallowRef<HTMLElement>();
const renoteButton = shallowRef<HTMLElement>(); const renoteButton = shallowRef<HTMLElement>();
const quoteButton = shallowRef<HTMLElement>(); const quoteButton = shallowRef<HTMLElement>();
@ -390,7 +391,7 @@ function menu(viaKeyboard = false): void {
if (props.detail) { if (props.detail) {
os.api('notes/children', { os.api('notes/children', {
noteId: props.note.id, noteId: props.note.id,
limit: 5, limit: numberOfReplies.value,
showQuotes: false, showQuotes: false,
}).then(res => { }).then(res => {
replies = res; replies = res;

View File

@ -72,7 +72,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</footer> </footer>
</div> </div>
</div> </div>
<template v-if="depth < 5"> <template v-if="depth < numberOfReplies">
<SkNoteSub v-for="reply in replies" :key="reply.id" :note="reply" :class="[$style.reply, { [$style.single]: replies.length === 1 }]" :detail="true" :depth="depth + 1" :expandAllCws="props.expandAllCws"/> <SkNoteSub v-for="reply in replies" :key="reply.id" :note="reply" :class="[$style.reply, { [$style.single]: replies.length === 1 }]" :detail="true" :depth="depth + 1" :expandAllCws="props.expandAllCws"/>
</template> </template>
<div v-else :class="$style.more"> <div v-else :class="$style.more">
@ -133,6 +133,7 @@ const translation = ref<any>(null);
const translating = ref(false); const translating = ref(false);
const isDeleted = ref(false); const isDeleted = ref(false);
const renoted = ref(false); const renoted = ref(false);
const numberOfReplies = ref(defaultStore.state.numberOfReplies);
const reactButton = shallowRef<HTMLElement>(); const reactButton = shallowRef<HTMLElement>();
const renoteButton = shallowRef<HTMLElement>(); const renoteButton = shallowRef<HTMLElement>();
const quoteButton = shallowRef<HTMLElement>(); const quoteButton = shallowRef<HTMLElement>();
@ -399,7 +400,7 @@ function menu(viaKeyboard = false): void {
if (props.detail) { if (props.detail) {
os.api('notes/children', { os.api('notes/children', {
noteId: props.note.id, noteId: props.note.id,
limit: 5, limit: numberOfReplies.value,
showQuotes: false, showQuotes: false,
}).then(res => { }).then(res => {
replies = res; replies = res;

View File

@ -89,6 +89,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="1_1">{{ i18n.t('limitTo', { x: '1:1' }) }}</option> <option value="1_1">{{ i18n.t('limitTo', { x: '1:1' }) }}</option>
<option value="2_3">{{ i18n.t('limitTo', { x: '2:3' }) }}</option> <option value="2_3">{{ i18n.t('limitTo', { x: '2:3' }) }}</option>
</MkRadios> </MkRadios>
<MkRange v-model="numberOfReplies" :min="2" :max="20" :step="1" easing>
<template #label>{{ i18n.ts.numberOfReplies }}</template>
<template #caption>{{ i18n.ts.numberOfRepliesDescription }}</template>
</MkRange>
</div> </div>
</FormSection> </FormSection>
@ -268,6 +273,7 @@ const nsfw = computed(defaultStore.makeGetterSetter('nsfw'));
const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostForm')); const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostForm'));
const showFixedPostFormInChannel = computed(defaultStore.makeGetterSetter('showFixedPostFormInChannel')); const showFixedPostFormInChannel = computed(defaultStore.makeGetterSetter('showFixedPostFormInChannel'));
const numberOfPageCache = computed(defaultStore.makeGetterSetter('numberOfPageCache')); const numberOfPageCache = computed(defaultStore.makeGetterSetter('numberOfPageCache'));
const numberOfReplies = computed(defaultStore.makeGetterSetter('numberOfReplies'));
const instanceTicker = computed(defaultStore.makeGetterSetter('instanceTicker')); const instanceTicker = computed(defaultStore.makeGetterSetter('instanceTicker'));
const enableInfiniteScroll = computed(defaultStore.makeGetterSetter('enableInfiniteScroll')); const enableInfiniteScroll = computed(defaultStore.makeGetterSetter('enableInfiniteScroll'));
const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu')); const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu'));

View File

@ -90,6 +90,7 @@ const defaultStoreSaveKeys: (keyof typeof defaultStore['state'])[] = [
'reportError', 'reportError',
'squareAvatars', 'squareAvatars',
'numberOfPageCache', 'numberOfPageCache',
'numberOfReplies',
'aiChanMode', 'aiChanMode',
'mediaListWithOneImageAppearance', 'mediaListWithOneImageAppearance',
]; ];

View File

@ -346,6 +346,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device', where: 'device',
default: 3, default: 3,
}, },
numberOfReplies: {
where: 'device',
default: 5,
},
showNoteActionsOnlyHover: { showNoteActionsOnlyHover: {
where: 'device', where: 'device',
default: false, default: false,