fix(desktop): excludePrivate not working for local change

This commit is contained in:
Stephen Zhou
2025-06-18 14:54:51 +08:00
parent 472ee72b52
commit 7a74ebe895
2 changed files with 8 additions and 2 deletions
@@ -25,12 +25,18 @@ export const getSubscriptionByEntryId = (entryId: string | undefined) => {
export const getSubscribedFeedIdAndInboxHandlesByView = (
view: FeedViewType | undefined,
excludePrivate: boolean,
): string[] => {
if (typeof view !== "number") return []
const state = useSubscriptionStore.getState()
return Array.from(state.feedIdByView[view])
.filter((i) => !excludePrivate || !state.data[i]?.isPrivate)
.concat(view === FeedViewType.Articles ? getInboxList().map((i) => i.id) : [])
.concat(Array.from(state.listIdByView[view]).flatMap((id) => getListFeedIds(id) ?? []))
.concat(
Array.from(state.listIdByView[view])
.filter((i) => !excludePrivate || !state.data[i]?.isPrivate)
.flatMap((id) => getListFeedIds(id) ?? []),
)
}
export const getSubscribedFeedIdsByView = (view: FeedViewType): string[] => {
+1 -1
View File
@@ -143,7 +143,7 @@ class UnreadSyncService {
} else if (filter?.inboxId) {
await this.updateUnreadStatus({ ids: [filter.inboxId], time, request })
} else {
const feedIdAndInboxHandles = getSubscribedFeedIdAndInboxHandlesByView(view)
const feedIdAndInboxHandles = getSubscribedFeedIdAndInboxHandlesByView(view, excludePrivate)
await this.updateUnreadStatus({ ids: feedIdAndInboxHandles, time, request })
}
}