Skip to content

Commit

Permalink
Fix pinned channels double selection (#6758)
Browse files Browse the repository at this point in the history
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
  • Loading branch information
kristina-fefelova authored Sep 29, 2024
1 parent 41a2283 commit 636d704
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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[] = []
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 636d704

Please sign in to comment.