mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
Chunter: Show "edited" label and cancel button (#1411)
Signed-off-by: Denis Bunakalya <denis.bunakalya@xored.com>
This commit is contained in:
parent
e67a7c0464
commit
8d89816e8f
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -35,6 +35,7 @@
|
||||
"UnpinMessage": "Открепить сообщение",
|
||||
"Pinned": "Закреплено:",
|
||||
"EditMessage": "Редактировать сообщение",
|
||||
"Edited": "отредактировано",
|
||||
"DeleteMessage": "Удалить сообщение",
|
||||
"AndYou": "{participants, plural, =0 {Только вы} other {и вы}}",
|
||||
"ShowMoreReplies": "{count, plural, =3 {Показать еще # ответа} =4 {Показать еще # ответа} other {Показать еще # ответов}}"
|
||||
|
@ -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 @@
|
||||
<div class="header">
|
||||
{#if employee}{formatName(employee.name)}{/if}
|
||||
<span>{getTime(message.createOn)}</span>
|
||||
{#if message.editedOn}
|
||||
<span>
|
||||
<Tooltip label={ui.string.TimeTooltip} props={{ value: getTime(message.editedOn) }}>
|
||||
<Label label={chunter.string.Edited}/>
|
||||
</Tooltip>
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if isEditing}
|
||||
<AttachmentRefInput
|
||||
bind:this={refInput}
|
||||
space={message.space}
|
||||
_class={chunter.class.Comment}
|
||||
objectId={message._id}
|
||||
content={message.content}
|
||||
showSend={false}
|
||||
on:message={onMessageEdit}
|
||||
/>
|
||||
<div class="flex-row-reverse gap-2 reverse">
|
||||
<Button
|
||||
label={chunter.string.EditCancel}
|
||||
on:click={() => isEditing = false}
|
||||
/>
|
||||
<Button label={chunter.string.EditUpdate} on:click={() => refInput.submit()} />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="text"><MessageViewer message={message.content} /></div>
|
||||
{#if message.attachments}<div class="attachments"><AttachmentList {attachments} /></div>{/if}
|
||||
@ -210,6 +226,8 @@
|
||||
margin-left: 1rem;
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: 500;
|
||||
font-size: 1rem;
|
||||
line-height: 150%;
|
||||
|
@ -57,6 +57,7 @@ export default mergeIds(chunterId, chunter, {
|
||||
Pinned: '' as IntlString,
|
||||
DeleteMessage: '' as IntlString,
|
||||
EditMessage: '' as IntlString,
|
||||
Edited: '' as IntlString,
|
||||
AndYou: '' as IntlString,
|
||||
ShowMoreReplies: '' as IntlString
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ export interface ChunterMessage extends AttachedDoc {
|
||||
attachments?: number
|
||||
createBy: Ref<Account>
|
||||
createOn: Timestamp
|
||||
editedOn?: Timestamp
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user