summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-08-16 21:43:20 +0900
committerGitHub <noreply@github.com>2024-08-16 21:43:20 +0900
commit6db3c50e32eb985ed76543e68ef0d75ffdad6874 (patch)
tree0b48c832df54200f94ab8f9f76eead3303c3dc93
parentfix(frontend): correct condition to displayed as system account on moderation... (diff)
downloadsharkey-6db3c50e32eb985ed76543e68ef0d75ffdad6874.tar.gz
sharkey-6db3c50e32eb985ed76543e68ef0d75ffdad6874.tar.bz2
sharkey-6db3c50e32eb985ed76543e68ef0d75ffdad6874.zip
fix(frontend): Misskeyの利用中に使用できるタイムラインの種類が変化した場合、使用できないタイムラインが表示されないように (#14412)
* fix(frontend): Misskeyの利用中に使用できるタイムラインの種類が変化した場合、使用できないタイムラインが表示されないように * Update timeline.vue * Update timeline.vue
-rw-r--r--packages/frontend/src/pages/timeline.vue24
1 files changed, 20 insertions, 4 deletions
diff --git a/packages/frontend/src/pages/timeline.vue b/packages/frontend/src/pages/timeline.vue
index 32f6dd0e5a..258d1443d9 100644
--- a/packages/frontend/src/pages/timeline.vue
+++ b/packages/frontend/src/pages/timeline.vue
@@ -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 = [
{