chore: collapse renotes of sensitive channel on basic timelines
This commit is contained in:
parent
99a4553923
commit
0a3cee85b4
|
|
@ -270,7 +270,7 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
// for some timelines, like home timeline which only shows the following channels,
|
// for some timelines, like home timeline which only shows the following channels,
|
||||||
// we never collapse sensitive channel notes so we allow inject to override the preference
|
// we never collapse sensitive channel notes so we allow inject to override the preference
|
||||||
const collapseSensitiveChannel: boolean = inject<boolean | undefined>('collapseSensitiveChannel', undefined) ?? prefer.s.collapseSensitiveChannel;
|
const collapseSensitiveChannelContext = inject(DI.collapseSensitiveChannel, true);
|
||||||
const inTimeline = inject<boolean>('inTimeline', false);
|
const inTimeline = inject<boolean>('inTimeline', false);
|
||||||
const tl_withSensitive = inject<Ref<boolean>>('tl_withSensitive', ref(true));
|
const tl_withSensitive = inject<Ref<boolean>>('tl_withSensitive', ref(true));
|
||||||
const inChannel = inject('inChannel', null);
|
const inChannel = inject('inChannel', null);
|
||||||
|
|
@ -362,7 +362,20 @@ function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string
|
||||||
|
|
||||||
if (checkOnly) return false;
|
if (checkOnly) return false;
|
||||||
|
|
||||||
if (collapseSensitiveChannel && noteToCheck.channel?.isSensitive) return 'sensitiveChannel';
|
if (noteToCheck.channel?.isSensitive) {
|
||||||
|
if (prefer.s.collapseSensitiveChannel) {
|
||||||
|
switch (collapseSensitiveChannelContext) {
|
||||||
|
case true: return 'sensitiveChannel';
|
||||||
|
case 'renote-only':
|
||||||
|
if (note.channel?.id !== appearNote.channel?.id) {
|
||||||
|
return 'sensitiveChannel';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case false:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (inTimeline && tl_withSensitive.value === false && noteToCheck.files?.some((v) => v.isSensitive)) {
|
if (inTimeline && tl_withSensitive.value === false && noteToCheck.files?.some((v) => v.isSensitive)) {
|
||||||
return 'sensitiveMute';
|
return 'sensitiveMute';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,5 @@ export const DI = {
|
||||||
mfmEmojiReactCallback: Symbol() as InjectionKey<(emoji: string) => void>,
|
mfmEmojiReactCallback: Symbol() as InjectionKey<(emoji: string) => void>,
|
||||||
inModal: Symbol() as InjectionKey<boolean>,
|
inModal: Symbol() as InjectionKey<boolean>,
|
||||||
inAppSearchMarkerId: Symbol() as InjectionKey<Ref<string | null>>,
|
inAppSearchMarkerId: Symbol() as InjectionKey<Ref<string | null>>,
|
||||||
|
collapseSensitiveChannel: Symbol() as InjectionKey<boolean | 'renote-only'>,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ import { notesSearchAvailable } from '@/utility/check-permissions.js';
|
||||||
import { miLocalStorage } from '@/local-storage.js';
|
import { miLocalStorage } from '@/local-storage.js';
|
||||||
import { useRouter } from '@/router.js';
|
import { useRouter } from '@/router.js';
|
||||||
import { Paginator } from '@/utility/paginator.js';
|
import { Paginator } from '@/utility/paginator.js';
|
||||||
|
import { DI } from '@/di';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
|
@ -107,7 +108,7 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// チャンネルタイムラインには目的のチャンネルしか原則表示されないので、折りたたみを無効化する
|
// チャンネルタイムラインには目的のチャンネルしか原則表示されないので、折りたたみを無効化する
|
||||||
provide('collapseSensitiveChannel', false);
|
provide(DI.collapseSensitiveChannel, false);
|
||||||
|
|
||||||
const tab = ref('overview');
|
const tab = ref('overview');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,14 @@ import * as os from '@/os.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { definePage } from '@/page.js';
|
import { definePage } from '@/page.js';
|
||||||
import { Paginator } from '@/utility/paginator.js';
|
import { Paginator } from '@/utility/paginator.js';
|
||||||
|
import { DI } from '@/di';
|
||||||
|
|
||||||
const tab = ref('all');
|
const tab = ref('all');
|
||||||
const includeTypes = ref<string[] | null>(null);
|
const includeTypes = ref<string[] | null>(null);
|
||||||
const excludeTypes = computed(() => includeTypes.value ? notificationTypes.filter(t => !includeTypes.value!.includes(t)) : null);
|
const excludeTypes = computed(() => includeTypes.value ? notificationTypes.filter(t => !includeTypes.value!.includes(t)) : null);
|
||||||
|
|
||||||
// 通知では自分がセンシティブタイムラインにした投稿の反応が表示される可能性があるため、折りたたみを無効化する
|
// 通知では自分がセンシティブタイムラインにした投稿の反応が表示される可能性があるため、折りたたみを無効化する
|
||||||
provide('collapseSensitiveChannel', false);
|
provide(DI.collapseSensitiveChannel, false);
|
||||||
|
|
||||||
const mentionsPaginator = markRaw(new Paginator('notes/mentions', {
|
const mentionsPaginator = markRaw(new Paginator('notes/mentions', {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,12 @@ import { deepMerge } from '@/utility/merge.js';
|
||||||
import { miLocalStorage } from '@/local-storage.js';
|
import { miLocalStorage } from '@/local-storage.js';
|
||||||
import { availableBasicTimelines, hasWithReplies, isAvailableBasicTimeline, isBasicTimeline, basicTimelineIconClass } from '@/timelines.js';
|
import { availableBasicTimelines, hasWithReplies, isAvailableBasicTimeline, isBasicTimeline, basicTimelineIconClass } from '@/timelines.js';
|
||||||
import { prefer } from '@/preferences.js';
|
import { prefer } from '@/preferences.js';
|
||||||
|
import { DI } from '@/di';
|
||||||
|
|
||||||
const tlComponent = useTemplateRef('tlComponent');
|
const tlComponent = useTemplateRef('tlComponent');
|
||||||
|
|
||||||
// ホームタイムラインにはフォロー中のチャンネルしか原則表示されないので、折りたたみを無効化する
|
// ホームタイムラインにはフォロー中のチャンネルし以外の場合に折りたたみを無効化する。
|
||||||
provide('collapseSensitiveChannel', false);
|
provide(DI.collapseSensitiveChannel, 'renote-only');
|
||||||
|
|
||||||
type TimelinePageSrc = BasicTimelineType | `list:${string}`;
|
type TimelinePageSrc = BasicTimelineType | `list:${string}`;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import { favoritedChannelsCache } from '@/cache.js';
|
||||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { soundSettingsButton } from '@/ui/deck/tl-note-notification.js';
|
import { soundSettingsButton } from '@/ui/deck/tl-note-notification.js';
|
||||||
|
import { DI } from '@/di';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
column: Column;
|
column: Column;
|
||||||
|
|
@ -40,7 +41,7 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// チャンネルタイムラインには目的のチャンネルしか原則表示されないので、折りたたみを無効化する
|
// チャンネルタイムラインには目的のチャンネルしか原則表示されないので、折りたたみを無効化する
|
||||||
provide('collapseSensitiveChannel', false);
|
provide(DI.collapseSensitiveChannel, false);
|
||||||
|
|
||||||
const timeline = useTemplateRef('timeline');
|
const timeline = useTemplateRef('timeline');
|
||||||
const channel = shallowRef<Misskey.entities.Channel>();
|
const channel = shallowRef<Misskey.entities.Channel>();
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import { updateColumn } from '@/deck.js';
|
||||||
import MkStreamingNotificationsTimeline from '@/components/MkStreamingNotificationsTimeline.vue';
|
import MkStreamingNotificationsTimeline from '@/components/MkStreamingNotificationsTimeline.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
import { DI } from '@/di';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
column: Column;
|
column: Column;
|
||||||
|
|
@ -26,7 +27,7 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// 通知では自分がセンシティブタイムラインにした投稿の反応が表示される可能性があるため、折りたたみを無効化する
|
// 通知では自分がセンシティブタイムラインにした投稿の反応が表示される可能性があるため、折りたたみを無効化する
|
||||||
provide('collapseSensitiveChannel', false);
|
provide(DI.collapseSensitiveChannel, false);
|
||||||
|
|
||||||
const notificationsComponent = useTemplateRef('notificationsComponent');
|
const notificationsComponent = useTemplateRef('notificationsComponent');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,15 @@ import * as os from '@/os.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { hasWithReplies, isAvailableBasicTimeline, basicTimelineIconClass } from '@/timelines.js';
|
import { hasWithReplies, isAvailableBasicTimeline, basicTimelineIconClass } from '@/timelines.js';
|
||||||
import { soundSettingsButton } from '@/ui/deck/tl-note-notification.js';
|
import { soundSettingsButton } from '@/ui/deck/tl-note-notification.js';
|
||||||
|
import { DI } from '@/di';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
column: Column;
|
column: Column;
|
||||||
isStacked: boolean;
|
isStacked: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// ホームタイムラインにはフォロー中のチャンネルしか原則表示されないので、折りたたみを無効化する
|
// ホームタイムラインにはフォロー中のチャンネルし以外の場合に折りたたみを無効化する。
|
||||||
provide('collapseSensitiveChannel', false);
|
provide(DI.collapseSensitiveChannel, 'renote-only');
|
||||||
|
|
||||||
const timeline = useTemplateRef('timeline');
|
const timeline = useTemplateRef('timeline');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue