mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-26 18:29:51 +00: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)
|
@Prop(TypeTimestamp(), chunter.string.Create)
|
||||||
createOn!: Timestamp
|
createOn!: Timestamp
|
||||||
|
|
||||||
|
@Prop(TypeTimestamp(), chunter.string.Edit)
|
||||||
|
editedOn?: Timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Model(chunter.class.ThreadMessage, chunter.class.ChunterMessage)
|
@Model(chunter.class.ThreadMessage, chunter.class.ChunterMessage)
|
||||||
|
@ -48,6 +48,7 @@ export default mergeIds(chunterId, chunter, {
|
|||||||
Chat: '' as IntlString,
|
Chat: '' as IntlString,
|
||||||
CreateBy: '' as IntlString,
|
CreateBy: '' as IntlString,
|
||||||
Create: '' as IntlString,
|
Create: '' as IntlString,
|
||||||
|
Edit: '' as IntlString,
|
||||||
MarkUnread: '' as IntlString,
|
MarkUnread: '' as IntlString,
|
||||||
LastMessage: '' as IntlString,
|
LastMessage: '' as IntlString,
|
||||||
PinnedMessages: '' as IntlString
|
PinnedMessages: '' as IntlString
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
"UnpinMessage": "Unpin message",
|
"UnpinMessage": "Unpin message",
|
||||||
"Pinned": "Pinned:",
|
"Pinned": "Pinned:",
|
||||||
"EditMessage": "Edit message",
|
"EditMessage": "Edit message",
|
||||||
|
"Edited": "edited",
|
||||||
"DeleteMessage": "Delete message",
|
"DeleteMessage": "Delete message",
|
||||||
"AndYou": "{participants, plural, =0 {Just you} other {and you}}",
|
"AndYou": "{participants, plural, =0 {Just you} other {and you}}",
|
||||||
"ShowMoreReplies": "Show {count} more replies"
|
"ShowMoreReplies": "Show {count} more replies"
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
"UnpinMessage": "Открепить сообщение",
|
"UnpinMessage": "Открепить сообщение",
|
||||||
"Pinned": "Закреплено:",
|
"Pinned": "Закреплено:",
|
||||||
"EditMessage": "Редактировать сообщение",
|
"EditMessage": "Редактировать сообщение",
|
||||||
|
"Edited": "отредактировано",
|
||||||
"DeleteMessage": "Удалить сообщение",
|
"DeleteMessage": "Удалить сообщение",
|
||||||
"AndYou": "{participants, plural, =0 {Только вы} other {и вы}}",
|
"AndYou": "{participants, plural, =0 {Только вы} other {и вы}}",
|
||||||
"ShowMoreReplies": "{count, plural, =3 {Показать еще # ответа} =4 {Показать еще # ответа} other {Показать еще # ответов}}"
|
"ShowMoreReplies": "{count, plural, =3 {Показать еще # ответа} =4 {Показать еще # ответа} other {Показать еще # ответов}}"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
import { NotificationClientImpl } from '@anticrm/notification-resources'
|
import { NotificationClientImpl } from '@anticrm/notification-resources'
|
||||||
import { getResource } from '@anticrm/platform'
|
import { getResource } from '@anticrm/platform'
|
||||||
import { Avatar, getClient, MessageViewer } from '@anticrm/presentation'
|
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 { Action } from '@anticrm/view'
|
||||||
import { getActions } from '@anticrm/view-resources'
|
import { getActions } from '@anticrm/view-resources'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
@ -40,6 +40,8 @@
|
|||||||
export let thread: boolean = false
|
export let thread: boolean = false
|
||||||
export let isPinned: boolean = false
|
export let isPinned: boolean = false
|
||||||
|
|
||||||
|
let refInput: AttachmentRefInput
|
||||||
|
|
||||||
$: employee = getEmployee(message)
|
$: employee = getEmployee(message)
|
||||||
$: attachments = (message.$lookup?.attachments ?? []) as Attachment[]
|
$: attachments = (message.$lookup?.attachments ?? []) as Attachment[]
|
||||||
|
|
||||||
@ -122,12 +124,10 @@
|
|||||||
async function onMessageEdit (event: CustomEvent) {
|
async function onMessageEdit (event: CustomEvent) {
|
||||||
const { message: newContent, attachments: newAttachments } = event.detail
|
const { message: newContent, attachments: newAttachments } = event.detail
|
||||||
|
|
||||||
if (newContent !== message.content || newAttachments !== attachments) {
|
|
||||||
await client.update(message, {
|
await client.update(message, {
|
||||||
content: newContent,
|
content: newContent,
|
||||||
attachments: newAttachments
|
attachments: newAttachments
|
||||||
})
|
})
|
||||||
}
|
|
||||||
isEditing = false
|
isEditing = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,15 +152,31 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
{#if employee}{formatName(employee.name)}{/if}
|
{#if employee}{formatName(employee.name)}{/if}
|
||||||
<span>{getTime(message.createOn)}</span>
|
<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>
|
</div>
|
||||||
{#if isEditing}
|
{#if isEditing}
|
||||||
<AttachmentRefInput
|
<AttachmentRefInput
|
||||||
|
bind:this={refInput}
|
||||||
space={message.space}
|
space={message.space}
|
||||||
_class={chunter.class.Comment}
|
_class={chunter.class.Comment}
|
||||||
objectId={message._id}
|
objectId={message._id}
|
||||||
content={message.content}
|
content={message.content}
|
||||||
|
showSend={false}
|
||||||
on:message={onMessageEdit}
|
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}
|
{:else}
|
||||||
<div class="text"><MessageViewer message={message.content} /></div>
|
<div class="text"><MessageViewer message={message.content} /></div>
|
||||||
{#if message.attachments}<div class="attachments"><AttachmentList {attachments} /></div>{/if}
|
{#if message.attachments}<div class="attachments"><AttachmentList {attachments} /></div>{/if}
|
||||||
@ -210,6 +226,8 @@
|
|||||||
margin-left: 1rem;
|
margin-left: 1rem;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 150%;
|
line-height: 150%;
|
||||||
|
@ -57,6 +57,7 @@ export default mergeIds(chunterId, chunter, {
|
|||||||
Pinned: '' as IntlString,
|
Pinned: '' as IntlString,
|
||||||
DeleteMessage: '' as IntlString,
|
DeleteMessage: '' as IntlString,
|
||||||
EditMessage: '' as IntlString,
|
EditMessage: '' as IntlString,
|
||||||
|
Edited: '' as IntlString,
|
||||||
AndYou: '' as IntlString,
|
AndYou: '' as IntlString,
|
||||||
ShowMoreReplies: '' as IntlString
|
ShowMoreReplies: '' as IntlString
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ export interface ChunterMessage extends AttachedDoc {
|
|||||||
attachments?: number
|
attachments?: number
|
||||||
createBy: Ref<Account>
|
createBy: Ref<Account>
|
||||||
createOn: Timestamp
|
createOn: Timestamp
|
||||||
|
editedOn?: Timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user