mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 20:39:03 +00:00
Fix undefined error on thread open (#7169)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
parent
99a35e08db
commit
f7d8edccd5
@ -18,7 +18,7 @@
|
|||||||
import activity, { ActivityExtension } from '@hcengineering/activity'
|
import activity, { ActivityExtension } from '@hcengineering/activity'
|
||||||
import { getClient } from '@hcengineering/presentation'
|
import { getClient } from '@hcengineering/presentation'
|
||||||
import { AnySvelteComponent, Icon, Label } from '@hcengineering/ui'
|
import { AnySvelteComponent, Icon, Label } from '@hcengineering/ui'
|
||||||
import { Asset, getResource, translate } from '@hcengineering/platform'
|
import { Asset, getResource, IntlString } from '@hcengineering/platform'
|
||||||
import view from '@hcengineering/view'
|
import view from '@hcengineering/view'
|
||||||
|
|
||||||
import { getChannelName, getObjectIcon } from '../utils'
|
import { getChannelName, getObjectIcon } from '../utils'
|
||||||
@ -38,10 +38,8 @@
|
|||||||
$: extensions = client.getModel().findAllSync(activity.class.ActivityExtension, { ofClass: object._class })
|
$: extensions = client.getModel().findAllSync(activity.class.ActivityExtension, { ofClass: object._class })
|
||||||
|
|
||||||
let icon: Asset | AnySvelteComponent | undefined = undefined
|
let icon: Asset | AnySvelteComponent | undefined = undefined
|
||||||
let name: string | undefined = undefined
|
|
||||||
|
|
||||||
$: void updateIcon(object._class)
|
$: void updateIcon(object._class)
|
||||||
$: void updateName(object)
|
|
||||||
|
|
||||||
async function updateIcon (_class: Ref<Class<Doc>>): Promise<void> {
|
async function updateIcon (_class: Ref<Class<Doc>>): Promise<void> {
|
||||||
if (isThread) {
|
if (isThread) {
|
||||||
@ -58,9 +56,11 @@
|
|||||||
icon = result
|
icon = result
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateName (object: Doc): Promise<void> {
|
async function getName (object: Doc): Promise<{ name: string | undefined, label: IntlString | undefined }> {
|
||||||
const titleIntl = client.getHierarchy().getClass(object._class).label
|
const name = await getChannelName(object._id, object._class, object)
|
||||||
name = (await getChannelName(object._id, object._class, object)) ?? (await translate(titleIntl, {}))
|
const label = client.getHierarchy().getClass(object._class).label
|
||||||
|
|
||||||
|
return { name, label }
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -82,9 +82,13 @@
|
|||||||
{#if icon}
|
{#if icon}
|
||||||
<Icon {icon} size="x-small" />
|
<Icon {icon} size="x-small" />
|
||||||
{/if}
|
{/if}
|
||||||
{#if name}
|
{#await getName(object) then data}
|
||||||
{name}
|
{#if data.name}
|
||||||
{/if}
|
{data.name}
|
||||||
|
{:else if data.label}
|
||||||
|
<Label label={data.label} />
|
||||||
|
{/if}
|
||||||
|
{/await}
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user