This commit is contained in:
mattyatea 2024-03-18 19:02:54 +09:00
parent d2a02da432
commit d3016a4d6a
7 changed files with 26 additions and 7 deletions

4
locales/index.d.ts vendored
View File

@ -4880,6 +4880,10 @@ export interface Locale extends ILocale {
* *
*/ */
"showRenotes": string; "showRenotes": string;
/**
* CWを非表示
*/
"showCw": string;
/** /**
* *
*/ */

View File

@ -1216,6 +1216,7 @@ authentication: "認証"
authenticationRequiredToContinue: "続けるには認証を行ってください" authenticationRequiredToContinue: "続けるには認証を行ってください"
dateAndTime: "日時" dateAndTime: "日時"
showRenotes: "リノートを表示" showRenotes: "リノートを表示"
showCw: "CWを非表示"
edited: "編集済み" edited: "編集済み"
notificationRecieveConfig: "通知の受信設定" notificationRecieveConfig: "通知の受信設定"
mutualFollow: "相互フォロー" mutualFollow: "相互フォロー"

View File

@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:ad="true" :ad="true"
:class="$style.notes" :class="$style.notes"
> >
<MkNote :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note" :withHardMute="true"/> <MkNote v-if="props.withCw && !note.cw || !props.withCw" :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note" :withHardMute="true" />
</MkDateSeparatedList> </MkDateSeparatedList>
</div> </div>
</template> </template>
@ -43,6 +43,7 @@ const props = defineProps<{
pagination: Paging; pagination: Paging;
noGap?: boolean; noGap?: boolean;
disableAutoLoad?: boolean; disableAutoLoad?: boolean;
withCw?: boolean;
}>(); }>();
const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>(); const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>();

View File

@ -10,6 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
ref="tlComponent" ref="tlComponent"
:pagination="paginationQuery" :pagination="paginationQuery"
:noGap="!defaultStore.state.showGapBetweenNotesInTimeline" :noGap="!defaultStore.state.showGapBetweenNotesInTimeline"
:withCw="props.withCw"
@queue="emit('queue', $event)" @queue="emit('queue', $event)"
@status="prComponent?.setDisabled($event)" @status="prComponent?.setDisabled($event)"
/> />
@ -38,11 +39,12 @@ const props = withDefaults(defineProps<{
withRenotes?: boolean; withRenotes?: boolean;
withReplies?: boolean; withReplies?: boolean;
onlyFiles?: boolean; onlyFiles?: boolean;
withCw?: boolean;
}>(), { }>(), {
withRenotes: true, withRenotes: true,
withReplies: false, withReplies: false,
onlyFiles: false, onlyFiles: false,
withCw: false,
}); });
const emit = defineEmits<{ const emit = defineEmits<{

View File

@ -146,9 +146,8 @@ import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
import { claimAchievement } from '@/scripts/achievements.js'; import { claimAchievement } from '@/scripts/achievements.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import { bannerDark, bannerLight, defaultStore, iconDark, iconLight } from '@/store'; import { bannerDark, bannerLight, defaultStore, iconDark, iconLight } from '@/store.js';
import { signinRequired } from '@/account.js';
import { $i } from '@/account.js';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
initialTab?: string; initialTab?: string;
}>(), { }>(), {
@ -166,6 +165,7 @@ watch(tab, () => {
let bannerUrl = ref(defaultStore.state.bannerUrl); let bannerUrl = ref(defaultStore.state.bannerUrl);
let iconUrl = ref(defaultStore.state.iconUrl); let iconUrl = ref(defaultStore.state.iconUrl);
const darkMode = computed(defaultStore.makeGetterSetter('darkMode')); const darkMode = computed(defaultStore.makeGetterSetter('darkMode'));
if (darkMode.value) { if (darkMode.value) {
bannerUrl.value = bannerDark; bannerUrl.value = bannerDark;
iconUrl.value = iconDark; iconUrl.value = iconDark;
@ -173,6 +173,7 @@ if (darkMode.value) {
bannerUrl.value = bannerLight; bannerUrl.value = bannerLight;
iconUrl.value = iconLight; iconUrl.value = iconLight;
} }
watch(darkMode, () => { watch(darkMode, () => {
if (darkMode.value) { if (darkMode.value) {
bannerUrl.value = bannerDark; bannerUrl.value = bannerDark;
@ -182,6 +183,7 @@ watch(darkMode, () => {
iconUrl.value = iconLight; iconUrl.value = iconLight;
} }
}); });
const initStats = () => misskeyApi('stats', { const initStats = () => misskeyApi('stats', {
}).then((res) => { }).then((res) => {
stats.value = res; stats.value = res;

View File

@ -24,6 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:withRenotes="withRenotes" :withRenotes="withRenotes"
:withReplies="withReplies" :withReplies="withReplies"
:onlyFiles="onlyFiles" :onlyFiles="onlyFiles"
:withCw="withCw"
:sound="true" :sound="true"
@queue="queueUpdated" @queue="queueUpdated"
/> />
@ -76,6 +77,10 @@ const withRenotes = computed<boolean>({
get: () => defaultStore.reactiveState.tl.value.filter.withRenotes, get: () => defaultStore.reactiveState.tl.value.filter.withRenotes,
set: (x) => saveTlFilter('withRenotes', x), set: (x) => saveTlFilter('withRenotes', x),
}); });
const withCw = computed<boolean>({
get: () => defaultStore.reactiveState.tl.value.filter.withCw,
set: (x) => saveTlFilter('withCw', x),
});
// computed // computed
const localSocialTLFilterSwitchStore = ref<'withReplies' | 'onlyFiles' | false>('withReplies'); const localSocialTLFilterSwitchStore = ref<'withReplies' | 'onlyFiles' | false>('withReplies');
@ -254,14 +259,17 @@ function closeTutorial(): void {
const headerActions = computed(() => { const headerActions = computed(() => {
const tmp = [ const tmp = [
{ icon: 'ti ti-dots', { icon: 'ti ti-dots',
text: i18n.ts.options, text: i18n.ts.options,
handler: (ev) => { handler: (ev) => {
os.popupMenu([{ os.popupMenu([{
type: 'switch', type: 'switch',
text: i18n.ts.showRenotes, text: i18n.ts.showRenotes,
ref: withRenotes, ref: withRenotes,
}, {
type: 'switch',
text: i18n.ts.showCw,
ref: withCw,
}, src.value === 'local' || src.value === 'social' ? { }, src.value === 'local' || src.value === 'social' ? {
type: 'switch', type: 'switch',
text: i18n.ts.showRepliesToOthersInTimeline, text: i18n.ts.showRepliesToOthersInTimeline,

View File

@ -273,6 +273,7 @@ export const defaultStore = markRaw(new Storage('base', {
withRenotes: true, withRenotes: true,
withSensitive: true, withSensitive: true,
onlyFiles: false, onlyFiles: false,
withCw: true,
}, },
}, },
}, },