Fix links resolvers (#2761)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-03-17 15:47:54 +06:00 committed by GitHub
parent 0f24fe80d6
commit 29a0986241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import { chunterId, ChunterMessage, Comment, ThreadMessage } from '@hcengineering/chunter'
import contact, { EmployeeAccount, getName } from '@hcengineering/contact'
import { Class, Client, Doc, getCurrentAccount, Obj, Ref, SortingOrder, Space, Timestamp } from '@hcengineering/core'
import { Class, Client, Doc, getCurrentAccount, Obj, Ref, Space, Timestamp } from '@hcengineering/core'
import { Asset } from '@hcengineering/platform'
import { getClient } from '@hcengineering/presentation'
import { getCurrentLocation, getPanelURI, Location, navigate } from '@hcengineering/ui'
@ -156,7 +156,7 @@ async function generateLocation (loc: Location, shortLink: string): Promise<Loca
return undefined
}
const classLabel = tokens[0]
const lastId = tokens[1]
const lastId = tokens[1] as Ref<Doc>
const client = getClient()
const hierarchy = client.getHierarchy()
const classes = [chunter.class.Message, chunter.class.ThreadMessage, chunter.class.Comment]
@ -171,7 +171,7 @@ async function generateLocation (loc: Location, shortLink: string): Promise<Loca
console.error(`Could not find class ${classLabel}.`)
return undefined
}
const doc = await client.findOne(_class, { _id: { $like: `%${lastId}` } }, { sort: { _id: SortingOrder.Descending } })
const doc = await client.findOne(_class, { _id: lastId })
if (doc === undefined) {
console.error(`Could not find message ${lastId}.`)
return undefined

View File

@ -23,7 +23,7 @@ import {
formatName,
getName
} from '@hcengineering/contact'
import { Doc, getCurrentAccount, ObjQueryType, Ref, SortingOrder, Timestamp, toIdMap } from '@hcengineering/core'
import { Doc, getCurrentAccount, ObjQueryType, Ref, Timestamp, toIdMap } from '@hcengineering/core'
import { createQuery, getClient } from '@hcengineering/presentation'
import { TemplateDataProvider } from '@hcengineering/templates'
import { getPanelURI, Location } from '@hcengineering/ui'
@ -185,7 +185,7 @@ async function generateLocation (loc: Location, shortLink: string): Promise<Loca
return undefined
}
const classLabel = tokens[0]
const lastId = tokens[1]
const lastId = tokens[1] as Ref<Contact>
const client = getClient()
const hierarchy = client.getHierarchy()
const classes = hierarchy.getDescendants(contact.class.Contact)
@ -196,7 +196,7 @@ async function generateLocation (loc: Location, shortLink: string): Promise<Loca
break
}
}
const doc = await client.findOne(_class, { _id: { $like: `%${lastId}` } }, { sort: { _id: SortingOrder.Descending } })
const doc = await client.findOne(_class, { _id: lastId })
if (doc === undefined) {
console.error(`Could not find contact ${lastId}.`)
return undefined