TSK-1274: Fix Kanban live updates (#3024)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-04-20 12:38:46 +07:00 committed by GitHub
parent fbb54dfe80
commit e5e9b69365
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -20,7 +20,7 @@ export function findProperty (objects: Doc[], propertyKey: string, value: any):
const result: Doc[] = [] const result: Doc[] = []
for (const object of objects) { for (const object of objects) {
const val = getObjectValue(propertyKey, object) const val = getObjectValue(propertyKey, object)
if (val === value || isArrayValueCheck(val, value)) { if (val === value || (val == null && value == null) || isArrayValueCheck(val, value)) {
result.push(object) result.push(object)
} }
} }

View File

@ -36,7 +36,8 @@ import core, {
Status, Status,
StatusManager, StatusManager,
StatusValue, StatusValue,
TxOperations TxOperations,
WithLookup
} from '@hcengineering/core' } from '@hcengineering/core'
import type { IntlString } from '@hcengineering/platform' import type { IntlString } from '@hcengineering/platform'
import { getResource } from '@hcengineering/platform' import { getResource } from '@hcengineering/platform'
@ -622,8 +623,17 @@ export async function groupByStatusCategories (
const existingCategories: StatusValue[] = [] const existingCategories: StatusValue[] = []
const statusMap = new Map<string, StatusValue>() const statusMap = new Map<string, StatusValue>()
const usedSpaces = new Set<Ref<Space>>()
const statusesList: Array<WithLookup<Status>> = []
for (const v of categories) { for (const v of categories) {
const status = mgr.byId.get(v) const status = mgr.byId.get(v)
if (status !== undefined) {
statusesList.push(status)
usedSpaces.add(status.space)
}
}
for (const status of statusesList) {
if (status !== undefined) { if (status !== undefined) {
let fst = statusMap.get(status.name.toLowerCase().trim()) let fst = statusMap.get(status.name.toLowerCase().trim())
if (fst === undefined) { if (fst === undefined) {
@ -632,7 +642,7 @@ export async function groupByStatusCategories (
(it) => (it) =>
it.ofAttribute === status.ofAttribute && it.ofAttribute === status.ofAttribute &&
it.name.toLowerCase().trim() === status.name.toLowerCase().trim() && it.name.toLowerCase().trim() === status.name.toLowerCase().trim() &&
(categories.includes(it._id) || it.space === status.space) (categories.includes(it._id) || usedSpaces.has(it.space))
) )
.sort((a, b) => a.rank.localeCompare(b.rank)) .sort((a, b) => a.rank.localeCompare(b.rank))
fst = new StatusValue(status.name, status.color, statuses) fst = new StatusValue(status.name, status.color, statuses)