mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-04 23:04:47 +00:00
UBERF-6189 Fix document inbox issues (#5072)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
183239f2fe
commit
7b4db2e94d
@ -383,6 +383,12 @@ function defineDocument (builder: Builder): void {
|
||||
['attachments', 'children', 'comments']
|
||||
)
|
||||
|
||||
// Activity & Inbox
|
||||
|
||||
builder.mixin(document.class.Document, core.class.Class, view.mixin.ObjectTitle, {
|
||||
titleProvider: document.function.DocumentTitleProvider
|
||||
})
|
||||
|
||||
// Search
|
||||
|
||||
builder.createDoc(
|
||||
|
@ -45,7 +45,7 @@ import Move from './components/Move.svelte'
|
||||
import DocumentToDoPresenter from './components/DocumentToDoPresenter.svelte'
|
||||
|
||||
import document from './plugin'
|
||||
import { createEmptyDocument, getDocumentLink, getDocumentUrl, resolveLocation } from './utils'
|
||||
import { createEmptyDocument, documentTitleProvider, getDocumentLink, getDocumentUrl, resolveLocation } from './utils'
|
||||
|
||||
const toObjectSearchResult = (e: WithLookup<Document>): ObjectSearchResult => ({
|
||||
doc: e,
|
||||
@ -152,7 +152,8 @@ export default async (): Promise<Resources> => ({
|
||||
function: {
|
||||
GetDocumentLink: getDocumentUrl,
|
||||
GetObjectLinkFragment: getDocumentLink,
|
||||
IsTeamspaceVisible: async (space: Teamspace) => !space.private || space.members.includes(getCurrentAccount()._id)
|
||||
IsTeamspaceVisible: async (space: Teamspace) => !space.private || space.members.includes(getCurrentAccount()._id),
|
||||
DocumentTitleProvider: documentTitleProvider
|
||||
},
|
||||
resolver: {
|
||||
Location: resolveLocation
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { type Doc } from '@hcengineering/core'
|
||||
import { type Client, type Doc, type Ref } from '@hcengineering/core'
|
||||
import document, { type Teamspace, documentId } from '@hcengineering/document'
|
||||
import { type IntlString, type Resource, mergeIds } from '@hcengineering/platform'
|
||||
import { type AnyComponent, type Location } from '@hcengineering/ui'
|
||||
@ -27,6 +27,7 @@ export default mergeIds(documentId, document, {
|
||||
CreateTeamspace: '' as AnyComponent
|
||||
},
|
||||
function: {
|
||||
DocumentTitleProvider: '' as Resource<<T extends Doc>(client: Client, ref: Ref<T>, doc?: T) => Promise<string>>,
|
||||
GetDocumentLink: '' as Resource<(doc: Doc, props: Record<string, any>) => Promise<string>>,
|
||||
GetObjectLinkFragment: '' as Resource<(doc: Doc, props: Record<string, any>) => Promise<Location>>,
|
||||
IsTeamspaceVisible: '' as Resource<(space: Teamspace) => Promise<boolean>>
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import {
|
||||
type AttachedData,
|
||||
type Client,
|
||||
type Ref,
|
||||
type TxOperations,
|
||||
getCollaborativeDoc,
|
||||
@ -138,3 +139,8 @@ function parseDocumentId (shortLink: string): Ref<Document> | undefined {
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
export async function documentTitleProvider (client: Client, ref: Ref<Document>, doc?: Document): Promise<string> {
|
||||
const object = doc ?? (await client.findOne(document.class.Document, { _id: ref }))
|
||||
return object?.name ?? ''
|
||||
}
|
||||
|
@ -114,7 +114,11 @@
|
||||
<Label label={hierarchy.getClass(value.attachedToClass).label} />
|
||||
{/if}
|
||||
<span class="title overflow-label clear-mins" {title}>
|
||||
{title ?? hierarchy.getClass(value.attachedToClass).label}
|
||||
{#if title}
|
||||
{title}
|
||||
{:else}
|
||||
<Label label={hierarchy.getClass(value.attachedToClass).label} />
|
||||
{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user