diff --git a/plugins/chunter-resources/src/components/ChannelPresenter.svelte b/plugins/chunter-resources/src/components/ChannelPresenter.svelte index 7ed2ba198d2..d959806c868 100644 --- a/plugins/chunter-resources/src/components/ChannelPresenter.svelte +++ b/plugins/chunter-resources/src/components/ChannelPresenter.svelte @@ -37,10 +37,7 @@ {#if value} - +
{#if icon} diff --git a/plugins/chunter-resources/src/components/EditChannelDescriptionAttachments.svelte b/plugins/chunter-resources/src/components/EditChannelDescriptionAttachments.svelte index 5620169d237..8059b93f58a 100644 --- a/plugins/chunter-resources/src/components/EditChannelDescriptionAttachments.svelte +++ b/plugins/chunter-resources/src/components/EditChannelDescriptionAttachments.svelte @@ -17,7 +17,7 @@ import attachment, { Attachment } from '@anticrm/attachment' import { AttachmentPresenter } from '@anticrm/attachment-resources' import { Channel } from '@anticrm/chunter' - import type { Doc } from '@anticrm/core' + import { Doc, SortingOrder } from '@anticrm/core' import { createQuery } from '@anticrm/presentation' import { Menu } from '@anticrm/view-resources' import { showPopup, IconMoreV, Label } from '@anticrm/ui' @@ -25,9 +25,11 @@ export let channel: Channel | undefined const query = createQuery() - let attachments: Attachment[] | undefined - let selectedRowNumber: number | undefined + let visibleAttachments: Attachment[] | undefined + let totalAttachments = 0 let attachmentsLimit: number | undefined = 5 + let selectedRowNumber: number | undefined + const sort = { modifiedOn: SortingOrder.Descending } const showMenu = async (ev: MouseEvent, object: Doc, rowNumber: number): Promise => { selectedRowNumber = rowNumber @@ -43,17 +45,25 @@ space: channel._id }, (res) => { - attachments = res + visibleAttachments = res + totalAttachments = res.total }, - attachmentsLimit ? { limit: attachmentsLimit } : undefined + attachmentsLimit + ? { + limit: attachmentsLimit, + sort: sort + } + : { + sort: sort + } )
- {#if attachments?.length} + {#if visibleAttachments?.length}
- {#each attachments as attachment, i} + {#each visibleAttachments as attachment, i}
@@ -65,7 +75,7 @@
{/each} - {#if attachmentsLimit && attachments.length === attachmentsLimit} + {#if attachmentsLimit && visibleAttachments.length < totalAttachments}
{ diff --git a/plugins/chunter-resources/src/components/EditChannelDescriptionTab.svelte b/plugins/chunter-resources/src/components/EditChannelDescriptionTab.svelte index 718a2e44120..b6ef0e13056 100644 --- a/plugins/chunter-resources/src/components/EditChannelDescriptionTab.svelte +++ b/plugins/chunter-resources/src/components/EditChannelDescriptionTab.svelte @@ -82,6 +82,6 @@ focus on:change={onDescriptionChange} /> - +
{/if} diff --git a/plugins/chunter-resources/src/components/Message.svelte b/plugins/chunter-resources/src/components/Message.svelte index ebb18edbfe8..12a897d0744 100644 --- a/plugins/chunter-resources/src/components/Message.svelte +++ b/plugins/chunter-resources/src/components/Message.svelte @@ -25,7 +25,7 @@ import { Action } from '@anticrm/view' import { getActions } from '@anticrm/view-resources' import { createEventDispatcher } from 'svelte' - import { UnpinMessage } from '../index'; + import { UnpinMessage } from '../index' import chunter from '../plugin' import { getTime } from '../utils' // import Share from './icons/Share.svelte' @@ -71,17 +71,17 @@ action: chunter.actionImpl.PinMessage } as Action) - $: isEditing = false; + $: isEditing = false const editAction = { label: chunter.string.EditMessage, - action: () => isEditing = true + action: () => (isEditing = true) } const deleteAction = { label: chunter.string.DeleteMessage, action: async () => { - (await client.findAll(chunter.class.ThreadMessage, { attachedTo: message._id as Ref })).forEach(c => { + ;(await client.findAll(chunter.class.ThreadMessage, { attachedTo: message._id as Ref })).forEach((c) => { UnpinMessage(c) }) UnpinMessage(message) @@ -123,13 +123,10 @@ const { message: newContent, attachments: newAttachments } = event.detail if (newContent !== message.content || newAttachments !== attachments) { - await client.update( - message, - { - content: newContent, - attachments: newAttachments - } - ) + await client.update(message, { + content: newContent, + attachments: newAttachments + }) } isEditing = false } @@ -157,12 +154,12 @@ {getTime(message.createOn)}
{#if isEditing} - {:else}
diff --git a/plugins/chunter-resources/src/components/PinnedMessagesPopup.svelte b/plugins/chunter-resources/src/components/PinnedMessagesPopup.svelte index 02e1df6138b..c579b10cec7 100644 --- a/plugins/chunter-resources/src/components/PinnedMessagesPopup.svelte +++ b/plugins/chunter-resources/src/components/PinnedMessagesPopup.svelte @@ -63,8 +63,7 @@
{ - if (pinnedIds.length === 1) - dispatch('close') + if (pinnedIds.length === 1) dispatch('close') UnpinMessage(message) }} > diff --git a/plugins/chunter-resources/src/components/Thread.svelte b/plugins/chunter-resources/src/components/Thread.svelte index eaf08bdc630..59012fee835 100644 --- a/plugins/chunter-resources/src/components/Thread.svelte +++ b/plugins/chunter-resources/src/components/Thread.svelte @@ -105,13 +105,19 @@ )) ) - async function getParticipants (comments: ThreadMessage[], parent: Message | undefined, employees: Map, Employee>): Promise { + async function getParticipants ( + comments: ThreadMessage[], + parent: Message | undefined, + employees: Map, Employee> + ): Promise { const refs = new Set(comments.map((p) => p.createBy)) if (parent !== undefined) { refs.add(parent.createBy) } refs.delete(getCurrentAccount()._id) - const accounts = await client.findAll(contact.class.EmployeeAccount, { _id: { $in: Array.from(refs) as Ref[] } }) + const accounts = await client.findAll(contact.class.EmployeeAccount, { + _id: { $in: Array.from(refs) as Ref[] } + }) const res: string[] = [] for (const account of accounts) { const employee = employees.get(account.employee) @@ -174,13 +180,25 @@ {#if parent} {#if total > comments.length} -
{ showAll = true }}>
+
{ + showAll = true + }} + > +
{/if} {#each comments as comment (comment._id)} {/each}
- +
{/if}
diff --git a/plugins/chunter-resources/src/components/ThreadView.svelte b/plugins/chunter-resources/src/components/ThreadView.svelte index 79b9d17f16e..8af0d4eedf0 100644 --- a/plugins/chunter-resources/src/components/ThreadView.svelte +++ b/plugins/chunter-resources/src/components/ThreadView.svelte @@ -15,7 +15,7 @@
@@ -44,7 +49,7 @@
{#each threads as thread (thread)} -
+
{/each}