mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-06 15:57:05 +00:00
Fix links resolvers (#2761)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
0f24fe80d6
commit
29a0986241
@ -1,6 +1,6 @@
|
|||||||
import { chunterId, ChunterMessage, Comment, ThreadMessage } from '@hcengineering/chunter'
|
import { chunterId, ChunterMessage, Comment, ThreadMessage } from '@hcengineering/chunter'
|
||||||
import contact, { EmployeeAccount, getName } from '@hcengineering/contact'
|
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 { Asset } from '@hcengineering/platform'
|
||||||
import { getClient } from '@hcengineering/presentation'
|
import { getClient } from '@hcengineering/presentation'
|
||||||
import { getCurrentLocation, getPanelURI, Location, navigate } from '@hcengineering/ui'
|
import { getCurrentLocation, getPanelURI, Location, navigate } from '@hcengineering/ui'
|
||||||
@ -156,7 +156,7 @@ async function generateLocation (loc: Location, shortLink: string): Promise<Loca
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
const classLabel = tokens[0]
|
const classLabel = tokens[0]
|
||||||
const lastId = tokens[1]
|
const lastId = tokens[1] as Ref<Doc>
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
const hierarchy = client.getHierarchy()
|
const hierarchy = client.getHierarchy()
|
||||||
const classes = [chunter.class.Message, chunter.class.ThreadMessage, chunter.class.Comment]
|
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}.`)
|
console.error(`Could not find class ${classLabel}.`)
|
||||||
return undefined
|
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) {
|
if (doc === undefined) {
|
||||||
console.error(`Could not find message ${lastId}.`)
|
console.error(`Could not find message ${lastId}.`)
|
||||||
return undefined
|
return undefined
|
||||||
|
@ -23,7 +23,7 @@ import {
|
|||||||
formatName,
|
formatName,
|
||||||
getName
|
getName
|
||||||
} from '@hcengineering/contact'
|
} 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 { createQuery, getClient } from '@hcengineering/presentation'
|
||||||
import { TemplateDataProvider } from '@hcengineering/templates'
|
import { TemplateDataProvider } from '@hcengineering/templates'
|
||||||
import { getPanelURI, Location } from '@hcengineering/ui'
|
import { getPanelURI, Location } from '@hcengineering/ui'
|
||||||
@ -185,7 +185,7 @@ async function generateLocation (loc: Location, shortLink: string): Promise<Loca
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
const classLabel = tokens[0]
|
const classLabel = tokens[0]
|
||||||
const lastId = tokens[1]
|
const lastId = tokens[1] as Ref<Contact>
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
const hierarchy = client.getHierarchy()
|
const hierarchy = client.getHierarchy()
|
||||||
const classes = hierarchy.getDescendants(contact.class.Contact)
|
const classes = hierarchy.getDescendants(contact.class.Contact)
|
||||||
@ -196,7 +196,7 @@ async function generateLocation (loc: Location, shortLink: string): Promise<Loca
|
|||||||
break
|
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) {
|
if (doc === undefined) {
|
||||||
console.error(`Could not find contact ${lastId}.`)
|
console.error(`Could not find contact ${lastId}.`)
|
||||||
return undefined
|
return undefined
|
||||||
|
Loading…
Reference in New Issue
Block a user