mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
Fix short links quickfix (#2745)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
6c18d7e474
commit
ea44bc8389
@ -1,22 +1,11 @@
|
||||
import { chunterId, ChunterMessage, Comment, ThreadMessage } from '@hcengineering/chunter'
|
||||
import contact, { EmployeeAccount, getName } from '@hcengineering/contact'
|
||||
import {
|
||||
Class,
|
||||
Client,
|
||||
Doc,
|
||||
getCurrentAccount,
|
||||
matchQuery,
|
||||
Obj,
|
||||
Ref,
|
||||
SortingOrder,
|
||||
Space,
|
||||
Timestamp
|
||||
} from '@hcengineering/core'
|
||||
import { Class, Client, Doc, getCurrentAccount, Obj, Ref, SortingOrder, Space, Timestamp } from '@hcengineering/core'
|
||||
import { Asset } from '@hcengineering/platform'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { getCurrentLocation, navigate, Location, getPanelURI } from '@hcengineering/ui'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
import { getCurrentLocation, getPanelURI, Location, navigate } from '@hcengineering/ui'
|
||||
import view from '@hcengineering/view'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
import { get, writable } from 'svelte/store'
|
||||
|
||||
import chunter from './plugin'
|
||||
@ -142,17 +131,7 @@ export async function getFragment (doc: Doc): Promise<string> {
|
||||
label = clazz.shortLabel
|
||||
}
|
||||
label = label ?? doc._class
|
||||
let length = 5
|
||||
let id = doc._id.slice(-length)
|
||||
const contacts = await client.findAll(chunter.class.Comment, {}, { projection: { _id: 1 } })
|
||||
let res = matchQuery(contacts, { _id: { $like: `@${id}` } }, chunter.class.Comment, hierarchy)
|
||||
while (res.length > 1) {
|
||||
length++
|
||||
id = doc._id.slice(-length)
|
||||
res = matchQuery(contacts, { _id: { $like: `@${id}` } }, chunter.class.Comment, hierarchy)
|
||||
}
|
||||
|
||||
return `${chunterId}|${label}-${id}`
|
||||
return `${chunterId}|${label}-${doc._id}`
|
||||
}
|
||||
|
||||
export async function resolveLocation (loc: Location): Promise<Location | undefined> {
|
||||
|
@ -23,16 +23,7 @@ import {
|
||||
formatName,
|
||||
getName
|
||||
} from '@hcengineering/contact'
|
||||
import {
|
||||
Doc,
|
||||
getCurrentAccount,
|
||||
matchQuery,
|
||||
ObjQueryType,
|
||||
Ref,
|
||||
SortingOrder,
|
||||
Timestamp,
|
||||
toIdMap
|
||||
} from '@hcengineering/core'
|
||||
import { Doc, getCurrentAccount, ObjQueryType, Ref, SortingOrder, Timestamp, toIdMap } from '@hcengineering/core'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { TemplateDataProvider } from '@hcengineering/templates'
|
||||
import { getPanelURI, Location } from '@hcengineering/ui'
|
||||
@ -162,15 +153,8 @@ export async function getContactLink (doc: Doc): Promise<string> {
|
||||
label = clazz.shortLabel
|
||||
}
|
||||
label = label ?? 'CONT'
|
||||
let length = 5
|
||||
let id = doc._id.slice(-length)
|
||||
const contacts = await client.findAll(clazz._id, {}, { projection: { _id: 1 } })
|
||||
let res = matchQuery(contacts, { _id: { $like: `@${id}` } }, clazz._id, hierarchy)
|
||||
while (res.length > 1) {
|
||||
length++
|
||||
id = doc._id.slice(-length)
|
||||
res = matchQuery(contacts, { _id: { $like: `@${id}` } }, clazz._id, hierarchy)
|
||||
}
|
||||
|
||||
const id = doc._id
|
||||
|
||||
return `${contactId}|${label}-${id}`
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
const client = getClient()
|
||||
const hierarchy = client.getHierarchy()
|
||||
|
||||
let href: string | undefined = getPanelURI(component, object._id, Hierarchy.mixinOrClass(object), 'content')
|
||||
let href: string | undefined = '#' + getPanelURI(component, object._id, Hierarchy.mixinOrClass(object), 'content')
|
||||
|
||||
async function getHref (object: Doc): Promise<void> {
|
||||
href = `#${await getObjectLinkFragment(hierarchy, object, props, component)}`
|
||||
|
@ -23,7 +23,6 @@ import core, {
|
||||
Collection,
|
||||
concatLink,
|
||||
Doc,
|
||||
matchQuery,
|
||||
Obj,
|
||||
Ref,
|
||||
RefTo,
|
||||
@ -280,17 +279,7 @@ async function getContactLink (doc: Doc, control: TriggerControl): Promise<strin
|
||||
label = clazz.shortLabel
|
||||
}
|
||||
label = label ?? 'CONT'
|
||||
let length = 5
|
||||
let id = doc._id.slice(-length)
|
||||
const contacts = await control.findAll(clazz._id, {}, { projection: { _id: 1 } })
|
||||
let res = matchQuery(contacts, { _id: { $like: `@${id}` } }, clazz._id, hierarchy)
|
||||
while (res.length > 1) {
|
||||
length++
|
||||
id = doc._id.slice(-length)
|
||||
res = matchQuery(contacts, { _id: { $like: `@${id}` } }, clazz._id, hierarchy)
|
||||
}
|
||||
|
||||
return `${contactId}|${label}-${id}`
|
||||
return `${contactId}|${label}-${doc._id}`
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user