fix: mark view as read for hideFromTimeline

This commit is contained in:
Stephen Zhou 2025-07-28 10:18:19 +08:00
parent 6e7b988e35
commit 897186a446
No known key found for this signature in database
2 changed files with 16 additions and 5 deletions

View File

@ -23,18 +23,25 @@ export const getSubscriptionByEntryId = (entryId: string | undefined) => {
return possibleSource.map((id) => getSubscriptionByFeedId(id)).find((s) => !!s)
}
export const getSubscribedFeedIdAndInboxHandlesByView = (
view: FeedViewType | undefined,
excludePrivate: boolean,
): string[] => {
export const getSubscribedFeedIdAndInboxHandlesByView = ({
view,
excludePrivate,
excludeHidden,
}: {
view: FeedViewType | undefined
excludePrivate: boolean
excludeHidden: boolean
}): string[] => {
if (typeof view !== "number") return []
const state = useSubscriptionStore.getState()
return Array.from(state.feedIdByView[view])
.filter((i) => !excludePrivate || !state.data[i]?.isPrivate)
.filter((i) => !excludeHidden || !state.data[i]?.hideFromTimeline)
.concat(view === FeedViewType.Articles ? getInboxList().map((i) => i.id) : [])
.concat(
Array.from(state.listIdByView[view])
.filter((i) => !excludePrivate || !state.data[i]?.isPrivate)
.filter((i) => !excludeHidden || !state.data[i]?.hideFromTimeline)
.flatMap((id) => getListFeedIds(id) ?? []),
)
}

View File

@ -150,7 +150,11 @@ class UnreadSyncService {
} else if (filter?.inboxId) {
await this.updateUnreadStatus({ ids: [filter.inboxId], time, request })
} else {
const feedIdAndInboxHandles = getSubscribedFeedIdAndInboxHandlesByView(view, excludePrivate)
const feedIdAndInboxHandles = getSubscribedFeedIdAndInboxHandlesByView({
view,
excludePrivate,
excludeHidden: true,
})
await this.updateUnreadStatus({ ids: feedIdAndInboxHandles, time, request })
}
}