mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-12-22 16:30:13 +00:00
fix(frontend): Misskeyの利用中に使用できるタイムラインの種類が変化した場合、使用できないタイムラインが表示されないように (#14412)
* fix(frontend): Misskeyの利用中に使用できるタイムラインの種類が変化した場合、使用できないタイムラインが表示されないように * Update timeline.vue * Update timeline.vue
This commit is contained in:
parent
26322048db
commit
6db3c50e32
1 changed files with 20 additions and 4 deletions
|
@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, watch, provide, shallowRef, ref } from 'vue';
|
||||
import { computed, watch, provide, shallowRef, ref, onMounted, onActivated } from 'vue';
|
||||
import type { Tab } from '@/components/global/MkPageHeader.tabs.vue';
|
||||
import MkTimeline from '@/components/MkTimeline.vue';
|
||||
import MkInfo from '@/components/MkInfo.vue';
|
||||
|
@ -53,15 +53,18 @@ import { deepMerge } from '@/scripts/merge.js';
|
|||
import { MenuItem } from '@/types/menu.js';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
import { availableBasicTimelines, hasWithReplies, isAvailableBasicTimeline, isBasicTimeline, basicTimelineIconClass } from '@/timelines.js';
|
||||
import type { BasicTimelineType } from '@/timelines.js';
|
||||
|
||||
provide('shouldOmitHeaderTitle', true);
|
||||
|
||||
const tlComponent = shallowRef<InstanceType<typeof MkTimeline>>();
|
||||
const rootEl = shallowRef<HTMLElement>();
|
||||
|
||||
type TimelinePageSrc = BasicTimelineType & `list:${string}`;
|
||||
|
||||
const queue = ref(0);
|
||||
const srcWhenNotSignin = ref<'local' | 'global'>(isAvailableBasicTimeline('local') ? 'local' : 'global');
|
||||
const src = computed<'home' | 'local' | 'social' | 'global' | `list:${string}`>({
|
||||
const src = computed<TimelinePageSrc>({
|
||||
get: () => ($i ? defaultStore.reactiveState.tl.value.src : srcWhenNotSignin.value),
|
||||
set: (x) => saveSrc(x),
|
||||
});
|
||||
|
@ -195,7 +198,7 @@ async function chooseChannel(ev: MouseEvent): Promise<void> {
|
|||
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
function saveSrc(newSrc: 'home' | 'local' | 'social' | 'global' | `list:${string}`): void {
|
||||
function saveSrc(newSrc: TimelinePageSrc): void {
|
||||
const out = deepMerge({ src: newSrc }, defaultStore.state.tl);
|
||||
|
||||
if (newSrc.startsWith('userList:')) {
|
||||
|
@ -236,6 +239,19 @@ function closeTutorial(): void {
|
|||
defaultStore.set('timelineTutorials', before);
|
||||
}
|
||||
|
||||
function switchTlIfNeeded() {
|
||||
if (isBasicTimeline(src.value) && !availableBasicTimelines().includes(src.value)) {
|
||||
src.value = availableBasicTimelines()[0];
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
switchTlIfNeeded();
|
||||
});
|
||||
onActivated(() => {
|
||||
switchTlIfNeeded();
|
||||
});
|
||||
|
||||
const headerActions = computed(() => {
|
||||
const tmp = [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue