diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index a7c28ea4c9..288d8cc92b 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -270,7 +270,7 @@ const emit = defineEmits<{ // 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 -const collapseSensitiveChannel: boolean = inject('collapseSensitiveChannel', undefined) ?? prefer.s.collapseSensitiveChannel; +const collapseSensitiveChannelContext = inject(DI.collapseSensitiveChannel, true); const inTimeline = inject('inTimeline', false); const tl_withSensitive = inject>('tl_withSensitive', ref(true)); const inChannel = inject('inChannel', null); @@ -362,7 +362,20 @@ function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array v.isSensitive)) { return 'sensitiveMute'; } diff --git a/packages/frontend/src/di.ts b/packages/frontend/src/di.ts index f09782ea38..0069713f38 100644 --- a/packages/frontend/src/di.ts +++ b/packages/frontend/src/di.ts @@ -18,4 +18,5 @@ export const DI = { mfmEmojiReactCallback: Symbol() as InjectionKey<(emoji: string) => void>, inModal: Symbol() as InjectionKey, inAppSearchMarkerId: Symbol() as InjectionKey>, + collapseSensitiveChannel: Symbol() as InjectionKey, }; diff --git a/packages/frontend/src/pages/channel.vue b/packages/frontend/src/pages/channel.vue index 22426e9cc4..614d0c9a4d 100644 --- a/packages/frontend/src/pages/channel.vue +++ b/packages/frontend/src/pages/channel.vue @@ -99,6 +99,7 @@ import { notesSearchAvailable } from '@/utility/check-permissions.js'; import { miLocalStorage } from '@/local-storage.js'; import { useRouter } from '@/router.js'; import { Paginator } from '@/utility/paginator.js'; +import { DI } from '@/di'; const router = useRouter(); @@ -107,7 +108,7 @@ const props = defineProps<{ }>(); // チャンネルタイムラインには目的のチャンネルしか原則表示されないので、折りたたみを無効化する -provide('collapseSensitiveChannel', false); +provide(DI.collapseSensitiveChannel, false); const tab = ref('overview'); diff --git a/packages/frontend/src/pages/notifications.vue b/packages/frontend/src/pages/notifications.vue index 902e73cd20..4534869a3e 100644 --- a/packages/frontend/src/pages/notifications.vue +++ b/packages/frontend/src/pages/notifications.vue @@ -28,13 +28,14 @@ import * as os from '@/os.js'; import { i18n } from '@/i18n.js'; import { definePage } from '@/page.js'; import { Paginator } from '@/utility/paginator.js'; +import { DI } from '@/di'; const tab = ref('all'); const includeTypes = ref(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', { limit: 10, diff --git a/packages/frontend/src/pages/timeline.vue b/packages/frontend/src/pages/timeline.vue index 03eab206c7..d93f60105a 100644 --- a/packages/frontend/src/pages/timeline.vue +++ b/packages/frontend/src/pages/timeline.vue @@ -44,11 +44,12 @@ import { deepMerge } from '@/utility/merge.js'; import { miLocalStorage } from '@/local-storage.js'; import { availableBasicTimelines, hasWithReplies, isAvailableBasicTimeline, isBasicTimeline, basicTimelineIconClass } from '@/timelines.js'; import { prefer } from '@/preferences.js'; +import { DI } from '@/di'; const tlComponent = useTemplateRef('tlComponent'); -// ホームタイムラインにはフォロー中のチャンネルしか原則表示されないので、折りたたみを無効化する -provide('collapseSensitiveChannel', false); +// ホームタイムラインにはフォロー中のチャンネルし以外の場合に折りたたみを無効化する。 +provide(DI.collapseSensitiveChannel, 'renote-only'); type TimelinePageSrc = BasicTimelineType | `list:${string}`; diff --git a/packages/frontend/src/ui/deck/channel-column.vue b/packages/frontend/src/ui/deck/channel-column.vue index 6a87166c4b..7c9cba000d 100644 --- a/packages/frontend/src/ui/deck/channel-column.vue +++ b/packages/frontend/src/ui/deck/channel-column.vue @@ -33,6 +33,7 @@ import { favoritedChannelsCache } from '@/cache.js'; import { misskeyApi } from '@/utility/misskey-api.js'; import { i18n } from '@/i18n.js'; import { soundSettingsButton } from '@/ui/deck/tl-note-notification.js'; +import { DI } from '@/di'; const props = defineProps<{ column: Column; @@ -40,7 +41,7 @@ const props = defineProps<{ }>(); // チャンネルタイムラインには目的のチャンネルしか原則表示されないので、折りたたみを無効化する -provide('collapseSensitiveChannel', false); +provide(DI.collapseSensitiveChannel, false); const timeline = useTemplateRef('timeline'); const channel = shallowRef(); diff --git a/packages/frontend/src/ui/deck/notifications-column.vue b/packages/frontend/src/ui/deck/notifications-column.vue index b750fd6372..077368bd4b 100644 --- a/packages/frontend/src/ui/deck/notifications-column.vue +++ b/packages/frontend/src/ui/deck/notifications-column.vue @@ -19,6 +19,7 @@ import { updateColumn } from '@/deck.js'; import MkStreamingNotificationsTimeline from '@/components/MkStreamingNotificationsTimeline.vue'; import * as os from '@/os.js'; import { i18n } from '@/i18n.js'; +import { DI } from '@/di'; const props = defineProps<{ column: Column; @@ -26,7 +27,7 @@ const props = defineProps<{ }>(); // 通知では自分がセンシティブタイムラインにした投稿の反応が表示される可能性があるため、折りたたみを無効化する -provide('collapseSensitiveChannel', false); +provide(DI.collapseSensitiveChannel, false); const notificationsComponent = useTemplateRef('notificationsComponent'); diff --git a/packages/frontend/src/ui/deck/tl-column.vue b/packages/frontend/src/ui/deck/tl-column.vue index 171f75ebcf..e48d3634b9 100644 --- a/packages/frontend/src/ui/deck/tl-column.vue +++ b/packages/frontend/src/ui/deck/tl-column.vue @@ -44,14 +44,15 @@ import * as os from '@/os.js'; import { i18n } from '@/i18n.js'; import { hasWithReplies, isAvailableBasicTimeline, basicTimelineIconClass } from '@/timelines.js'; import { soundSettingsButton } from '@/ui/deck/tl-note-notification.js'; +import { DI } from '@/di'; const props = defineProps<{ column: Column; isStacked: boolean; }>(); -// ホームタイムラインにはフォロー中のチャンネルしか原則表示されないので、折りたたみを無効化する -provide('collapseSensitiveChannel', false); +// ホームタイムラインにはフォロー中のチャンネルし以外の場合に折りたたみを無効化する。 +provide(DI.collapseSensitiveChannel, 'renote-only'); const timeline = useTemplateRef('timeline');