Fix collaborators tests (#9331)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2025-06-23 18:13:28 +04:00
committed by GitHub
parent 36d2c04d1e
commit a97ad110ff
2 changed files with 46 additions and 37 deletions
@@ -14,9 +14,9 @@
-->
<script lang="ts">
import { getCurrentEmployee } from '@hcengineering/contact'
import { Doc, DocumentQuery, getCurrentAccount, Ref } from '@hcengineering/core'
import core, { DocumentQuery, getCurrentAccount, Ref } from '@hcengineering/core'
import type { IntlString, Asset } from '@hcengineering/platform'
import { createQuery } from '@hcengineering/presentation'
import { createQuery, getClient } from '@hcengineering/presentation'
import type { Issue, IssueStatus } from '@hcengineering/tracker'
import { IModeSelector, resolvedLocationStore } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
@@ -28,6 +28,8 @@
export let config: [string, IntlString, object][] = []
export let icon: Asset | undefined = undefined
const client = getClient()
const hierarchy = client.getHierarchy()
const socialIds = getCurrentAccount().socialIds
const acc = getCurrentAccount().uuid
const dispatch = createEventDispatcher()
@@ -64,16 +66,16 @@
const subscribedQuery = createQuery()
$: subscribedQuery.query(
tracker.class.Issue,
{ 'notification:mixin:Collaborators.collaborators': acc },
(result) => {
const newSub = result.map((p) => p._id as Ref<Doc> as Ref<Issue>)
core.class.Collaborator,
{ collaborator: acc, attachedToClass: { $in: hierarchy.getDescendants(tracker.class.Issue) } },
(collaborators) => {
const newSub = collaborators.map((it) => it.attachedTo as Ref<Issue>)
const curSub = subscribed._id.$in
if (curSub.length !== newSub.length || curSub.some((id, i) => newSub[i] !== id)) {
subscribed = { _id: { $in: newSub } }
}
},
{ sort: { _id: 1 }, projection: { _id: 1 } }
{ sort: { attachedTo: 1 }, projection: { attachedTo: 1 } }
)
$: queries = { assigned, active, backlog, created, subscribed }