Fix pinned channels double selection (#6758)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-09-29 20:45:23 +04:00 committed by GitHub
parent 41a228387a
commit 636d7044c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,7 @@
-->
<script lang="ts">
import activity from '@hcengineering/activity'
import core, { Class, Doc, groupByArray, reduceCalls, Ref } from '@hcengineering/core'
import core, { Class, Doc, groupByArray, reduceCalls, Ref, Space } from '@hcengineering/core'
import { DocNotifyContext } from '@hcengineering/notification'
import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
import { IntlString } from '@hcengineering/platform'
@ -40,6 +40,7 @@
const hierarchy = client.getHierarchy()
const inboxClient = InboxNotificationsClientImpl.getClient()
const contextsStore = inboxClient.contexts
const contextByDocStore = inboxClient.contextByDoc
const objectsQueryByClass = new Map<Ref<Class<Doc>>, { query: LiveQuery, limit: number }>()
let contexts: DocNotifyContext[] = []
@ -69,7 +70,14 @@
sections = res
})
$: shouldPushObject = object !== undefined && getObjectGroup(object) === model.id
$: shouldPushObject =
object !== undefined &&
getObjectGroup(object) === model.id &&
(!$contextByDocStore.has(object._id) || isArchived(object))
function isArchived (object: Doc): boolean {
return hierarchy.isDerived(object._class, core.class.Space) ? (object as Space).archived : false
}
function loadObjects (contexts: DocNotifyContext[]): void {
const contextsByClass = groupByArray(contexts, ({ objectClass }) => objectClass)