diff --git a/models/gmail/src/index.ts b/models/gmail/src/index.ts index 093292a624..3019cd9223 100644 --- a/models/gmail/src/index.ts +++ b/models/gmail/src/index.ts @@ -15,9 +15,9 @@ // import activity from '@anticrm/activity' -import { Domain, IndexKind, Type } from '@anticrm/core' +import { Domain, IndexKind, Timestamp, Type } from '@anticrm/core' import type { Message, NewMessage, SharedMessage, SharedMessages } from '@anticrm/gmail' -import { ArrOf, Builder, Collection, Index, Model, Prop, TypeBoolean, TypeString } from '@anticrm/model' +import { ArrOf, Builder, Collection, Index, Model, Prop, TypeBoolean, TypeString, TypeTimestamp } from '@anticrm/model' import contact from '@anticrm/model-contact' import core, { TDoc, TAttachedDoc } from '@anticrm/model-core' import attachment from '@anticrm/model-attachment' @@ -67,6 +67,9 @@ export class TMessage extends TAttachedDoc implements Message { @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments) attachments?: number + + @Prop(TypeTimestamp(), core.string.Modified) + sendOn!: Timestamp } @Model(gmail.class.NewMessage, core.class.Doc, DOMAIN_GMAIL) diff --git a/models/telegram/src/index.ts b/models/telegram/src/index.ts index a85a34b4a7..919ff189e5 100644 --- a/models/telegram/src/index.ts +++ b/models/telegram/src/index.ts @@ -14,7 +14,7 @@ // limitations under the License. // -import { Builder, Model, TypeString, TypeBoolean, Prop, ArrOf, Index, Collection } from '@anticrm/model' +import { Builder, Model, TypeString, TypeBoolean, Prop, ArrOf, Index, Collection, TypeTimestamp } from '@anticrm/model' import core, { TAttachedDoc } from '@anticrm/model-core' import contact from '@anticrm/model-contact' import telegram from './plugin' @@ -24,7 +24,7 @@ import type { SharedTelegramMessage, SharedTelegramMessages } from '@anticrm/telegram' -import { Domain, IndexKind, Type } from '@anticrm/core' +import { Domain, IndexKind, Timestamp, Type } from '@anticrm/core' import setting from '@anticrm/setting' import activity from '@anticrm/activity' import attachment from '@anticrm/model-attachment' @@ -46,6 +46,9 @@ export class TTelegramMessage extends TAttachedDoc implements TelegramMessage { @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments) attachments?: number + + @Prop(TypeTimestamp(), core.string.Modified) + sendOn!: Timestamp } @Model(telegram.class.NewMessage, core.class.AttachedDoc, DOMAIN_TELEGRAM) diff --git a/plugins/gmail-resources/src/components/Chats.svelte b/plugins/gmail-resources/src/components/Chats.svelte index 07c6bffcec..c363c5ede4 100644 --- a/plugins/gmail-resources/src/components/Chats.svelte +++ b/plugins/gmail-resources/src/components/Chats.svelte @@ -55,7 +55,7 @@ const accountsIds = new Set(messages.map((p) => p.modifiedBy as Ref)) updateAccountsQuery(accountsIds) }, - { sort: { modifiedOn: SortingOrder.Descending } } + { sort: { sendOn: SortingOrder.Descending } } ) } diff --git a/plugins/gmail-resources/src/components/Message.svelte b/plugins/gmail-resources/src/components/Message.svelte index 75ff365399..46f5bdf18c 100644 --- a/plugins/gmail-resources/src/components/Message.svelte +++ b/plugins/gmail-resources/src/components/Message.svelte @@ -44,7 +44,7 @@
- {getTime(message.modifiedOn)} + {getTime(message.sendOn)}
diff --git a/plugins/gmail/src/index.ts b/plugins/gmail/src/index.ts index 023986799c..c1782aa449 100644 --- a/plugins/gmail/src/index.ts +++ b/plugins/gmail/src/index.ts @@ -15,7 +15,7 @@ import { plugin } from '@anticrm/platform' import type { Plugin } from '@anticrm/platform' -import type { Doc, Ref, Class, Space, AttachedDoc } from '@anticrm/core' +import type { Doc, Ref, Class, Space, AttachedDoc, Timestamp } from '@anticrm/core' import type { AnyComponent } from '@anticrm/ui' import type { IntegrationType, Handler } from '@anticrm/setting' @@ -27,6 +27,7 @@ export interface Message extends BaseMessage, AttachedDoc { from: string textContent: string incoming: boolean + sendOn: Timestamp } /** @@ -61,6 +62,7 @@ export interface SharedMessage extends Doc { textContent: string attachments?: number copy?: string[] + sendOn: Timestamp } /** diff --git a/plugins/telegram-resources/src/components/Chat.svelte b/plugins/telegram-resources/src/components/Chat.svelte index ed4f6af3d4..9a477fc283 100644 --- a/plugins/telegram-resources/src/components/Chat.svelte +++ b/plugins/telegram-resources/src/components/Chat.svelte @@ -18,8 +18,8 @@ import { AttachmentRefInput } from '@anticrm/attachment-resources' import { Panel } from '@anticrm/panel' import { createEventDispatcher } from 'svelte' - import contact, { Channel, EmployeeAccount, formatName } from '@anticrm/contact' - import { generateId, getCurrentAccount, Ref, SortingOrder, Space, Doc, Class } from '@anticrm/core' + import contact, { Channel, Contact, EmployeeAccount, formatName } from '@anticrm/contact' + import { generateId, getCurrentAccount, Ref, SortingOrder, Space, Class } from '@anticrm/core' import { NotificationClientImpl } from '@anticrm/notification-resources' import { createQuery, getClient } from '@anticrm/presentation' import setting, { Integration } from '@anticrm/setting' @@ -32,11 +32,11 @@ import Messages from './Messages.svelte' import Reconnect from './Reconnect.svelte' - export let _id: Ref - export let _class: Ref> + export let _id: Ref + export let _class: Ref> export let rightSection: AnyComponent | undefined = undefined - let object: any + let object: Contact let channel: Channel | undefined = undefined let objectId: Ref = generateId() @@ -85,7 +85,7 @@ updateAccountsQuery(accountsIds) }, { - sort: { modifiedOn: SortingOrder.Descending }, + sort: { sendOn: SortingOrder.Descending }, limit: 500, lookup: { _id: { attachments: attachment.class.Attachment } diff --git a/plugins/telegram-resources/src/components/Date.svelte b/plugins/telegram-resources/src/components/Date.svelte index 01841b29e7..f3ab4b379d 100644 --- a/plugins/telegram-resources/src/components/Date.svelte +++ b/plugins/telegram-resources/src/components/Date.svelte @@ -18,7 +18,7 @@ export let message: SharedTelegramMessage const current = new Date() - const target = new Date(message.modifiedOn) + const target = new Date(message.sendOn) let options: Intl.DateTimeFormatOptions = { day: 'numeric', month: 'long' @@ -32,7 +32,7 @@
- {new Intl.DateTimeFormat('default', options).format(message.modifiedOn)} + {new Intl.DateTimeFormat('default', options).format(message.sendOn)}