diff --git a/models/chunter/src/index.ts b/models/chunter/src/index.ts index 6f20bb38c2..879f4f6d7a 100644 --- a/models/chunter/src/index.ts +++ b/models/chunter/src/index.ts @@ -57,6 +57,9 @@ export class TChunterMessage extends TAttachedDoc implements ChunterMessage { @Prop(TypeTimestamp(), chunter.string.Create) createOn!: Timestamp + + @Prop(TypeTimestamp(), chunter.string.Edit) + editedOn?: Timestamp } @Model(chunter.class.ThreadMessage, chunter.class.ChunterMessage) diff --git a/models/chunter/src/plugin.ts b/models/chunter/src/plugin.ts index 87c05de9e3..d555ea68d7 100644 --- a/models/chunter/src/plugin.ts +++ b/models/chunter/src/plugin.ts @@ -48,6 +48,7 @@ export default mergeIds(chunterId, chunter, { Chat: '' as IntlString, CreateBy: '' as IntlString, Create: '' as IntlString, + Edit: '' as IntlString, MarkUnread: '' as IntlString, LastMessage: '' as IntlString, PinnedMessages: '' as IntlString diff --git a/plugins/chunter-assets/lang/en.json b/plugins/chunter-assets/lang/en.json index 5be5f808ff..81ec212e59 100644 --- a/plugins/chunter-assets/lang/en.json +++ b/plugins/chunter-assets/lang/en.json @@ -36,6 +36,7 @@ "UnpinMessage": "Unpin message", "Pinned": "Pinned:", "EditMessage": "Edit message", + "Edited": "edited", "DeleteMessage": "Delete message", "AndYou": "{participants, plural, =0 {Just you} other {and you}}", "ShowMoreReplies": "Show {count} more replies" diff --git a/plugins/chunter-assets/lang/ru.json b/plugins/chunter-assets/lang/ru.json index abf52dd6de..1d02530394 100644 --- a/plugins/chunter-assets/lang/ru.json +++ b/plugins/chunter-assets/lang/ru.json @@ -35,6 +35,7 @@ "UnpinMessage": "Открепить сообщение", "Pinned": "Закреплено:", "EditMessage": "Редактировать сообщение", + "Edited": "отредактировано", "DeleteMessage": "Удалить сообщение", "AndYou": "{participants, plural, =0 {Только вы} other {и вы}}", "ShowMoreReplies": "{count, plural, =3 {Показать еще # ответа} =4 {Показать еще # ответа} other {Показать еще # ответов}}" diff --git a/plugins/chunter-resources/src/components/Message.svelte b/plugins/chunter-resources/src/components/Message.svelte index 12a897d074..2cf7101877 100644 --- a/plugins/chunter-resources/src/components/Message.svelte +++ b/plugins/chunter-resources/src/components/Message.svelte @@ -21,7 +21,7 @@ import { NotificationClientImpl } from '@anticrm/notification-resources' import { getResource } from '@anticrm/platform' import { Avatar, getClient, MessageViewer } from '@anticrm/presentation' - import { ActionIcon, IconMoreH, Menu, showPopup } from '@anticrm/ui' + import ui, { ActionIcon, IconMoreH, Menu, showPopup, Label, Tooltip, Button } from '@anticrm/ui' import { Action } from '@anticrm/view' import { getActions } from '@anticrm/view-resources' import { createEventDispatcher } from 'svelte' @@ -40,6 +40,8 @@ export let thread: boolean = false export let isPinned: boolean = false + let refInput: AttachmentRefInput + $: employee = getEmployee(message) $: attachments = (message.$lookup?.attachments ?? []) as Attachment[] @@ -122,12 +124,10 @@ async function onMessageEdit (event: CustomEvent) { 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 } @@ -152,15 +152,31 @@