mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +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 { chunterId, ChunterMessage, Comment, ThreadMessage } from '@hcengineering/chunter'
|
||||||
import contact, { EmployeeAccount, getName } from '@hcengineering/contact'
|
import contact, { EmployeeAccount, getName } from '@hcengineering/contact'
|
||||||
import {
|
import { Class, Client, Doc, getCurrentAccount, Obj, Ref, SortingOrder, Space, Timestamp } from '@hcengineering/core'
|
||||||
Class,
|
|
||||||
Client,
|
|
||||||
Doc,
|
|
||||||
getCurrentAccount,
|
|
||||||
matchQuery,
|
|
||||||
Obj,
|
|
||||||
Ref,
|
|
||||||
SortingOrder,
|
|
||||||
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, navigate, Location, getPanelURI } from '@hcengineering/ui'
|
import { getCurrentLocation, getPanelURI, Location, navigate } from '@hcengineering/ui'
|
||||||
import { workbenchId } from '@hcengineering/workbench'
|
|
||||||
import view from '@hcengineering/view'
|
import view from '@hcengineering/view'
|
||||||
|
import { workbenchId } from '@hcengineering/workbench'
|
||||||
import { get, writable } from 'svelte/store'
|
import { get, writable } from 'svelte/store'
|
||||||
|
|
||||||
import chunter from './plugin'
|
import chunter from './plugin'
|
||||||
@ -142,17 +131,7 @@ export async function getFragment (doc: Doc): Promise<string> {
|
|||||||
label = clazz.shortLabel
|
label = clazz.shortLabel
|
||||||
}
|
}
|
||||||
label = label ?? doc._class
|
label = label ?? doc._class
|
||||||
let length = 5
|
return `${chunterId}|${label}-${doc._id}`
|
||||||
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}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resolveLocation (loc: Location): Promise<Location | undefined> {
|
export async function resolveLocation (loc: Location): Promise<Location | undefined> {
|
||||||
|
@ -23,16 +23,7 @@ import {
|
|||||||
formatName,
|
formatName,
|
||||||
getName
|
getName
|
||||||
} from '@hcengineering/contact'
|
} from '@hcengineering/contact'
|
||||||
import {
|
import { Doc, getCurrentAccount, ObjQueryType, Ref, SortingOrder, Timestamp, toIdMap } from '@hcengineering/core'
|
||||||
Doc,
|
|
||||||
getCurrentAccount,
|
|
||||||
matchQuery,
|
|
||||||
ObjQueryType,
|
|
||||||
Ref,
|
|
||||||
SortingOrder,
|
|
||||||
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'
|
||||||
@ -162,15 +153,8 @@ export async function getContactLink (doc: Doc): Promise<string> {
|
|||||||
label = clazz.shortLabel
|
label = clazz.shortLabel
|
||||||
}
|
}
|
||||||
label = label ?? 'CONT'
|
label = label ?? 'CONT'
|
||||||
let length = 5
|
|
||||||
let id = doc._id.slice(-length)
|
const id = doc._id
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${contactId}|${label}-${id}`
|
return `${contactId}|${label}-${id}`
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
const client = getClient()
|
const client = getClient()
|
||||||
const hierarchy = client.getHierarchy()
|
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> {
|
async function getHref (object: Doc): Promise<void> {
|
||||||
href = `#${await getObjectLinkFragment(hierarchy, object, props, component)}`
|
href = `#${await getObjectLinkFragment(hierarchy, object, props, component)}`
|
||||||
|
@ -23,7 +23,6 @@ import core, {
|
|||||||
Collection,
|
Collection,
|
||||||
concatLink,
|
concatLink,
|
||||||
Doc,
|
Doc,
|
||||||
matchQuery,
|
|
||||||
Obj,
|
Obj,
|
||||||
Ref,
|
Ref,
|
||||||
RefTo,
|
RefTo,
|
||||||
@ -280,17 +279,7 @@ async function getContactLink (doc: Doc, control: TriggerControl): Promise<strin
|
|||||||
label = clazz.shortLabel
|
label = clazz.shortLabel
|
||||||
}
|
}
|
||||||
label = label ?? 'CONT'
|
label = label ?? 'CONT'
|
||||||
let length = 5
|
return `${contactId}|${label}-${doc._id}`
|
||||||
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}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user