From d309ca124461bc270f0e733441da3cc26167b760 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Wed, 30 Apr 2025 07:40:53 +0900 Subject: [PATCH] wip --- packages/frontend/src/components/MkTimeline.vue | 8 ++++---- packages/frontend/src/pages/channel.vue | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/components/MkTimeline.vue b/packages/frontend/src/components/MkTimeline.vue index a4c8e0d68d..cf1cf99e3d 100644 --- a/packages/frontend/src/components/MkTimeline.vue +++ b/packages/frontend/src/components/MkTimeline.vue @@ -106,7 +106,7 @@ type TimelineQueryType = { roleId?: string }; -let noteCounterForAd = 0; +let adInsertionCounter = 0; const POLLING_INTERVAL = 1000 * 15; @@ -128,9 +128,9 @@ function releaseQueue() { } function prepend(note: Misskey.entities.Note) { - noteCounterForAd++; + adInsertionCounter++; - if (instance.notesPerOneAd > 0 && noteCounterForAd % instance.notesPerOneAd === 0) { + if (instance.notesPerOneAd > 0 && adInsertionCounter % instance.notesPerOneAd === 0) { note._shouldInsertAd_ = true; } @@ -319,7 +319,7 @@ onUnmounted(() => { function reloadTimeline() { return new Promise((res) => { - noteCounterForAd = 0; + adInsertionCounter = 0; paginator.reload().then(() => { res(); diff --git a/packages/frontend/src/pages/channel.vue b/packages/frontend/src/pages/channel.vue index ff5057cefd..5ead3b5fe6 100644 --- a/packages/frontend/src/pages/channel.vue +++ b/packages/frontend/src/pages/channel.vue @@ -73,6 +73,7 @@ SPDX-License-Identifier: AGPL-3.0-only import { computed, watch, ref } from 'vue'; import * as Misskey from 'misskey-js'; import { url } from '@@/js/config.js'; +import { useInterval } from '@@/js/use-interval.js'; import type { PageHeaderItem } from '@/types/page-header.js'; import MkPostForm from '@/components/MkPostForm.vue'; import MkTimeline from '@/components/MkTimeline.vue'; @@ -118,6 +119,14 @@ const featuredPagination = computed(() => ({ }, })); +useInterval(() => { + if (channel.value == null) return; + miLocalStorage.setItemAsJson(`channelLastReadedAt:${channel.value.id}`, Date.now()); +}, 3000, { + immediate: true, + afterMounted: true, +}); + watch(() => props.channelId, async () => { channel.value = await misskeyApi('channels/show', { channelId: props.channelId,