diff --git a/models/activity/src/index.ts b/models/activity/src/index.ts index d90fcfd300..a89ae4aa44 100644 --- a/models/activity/src/index.ts +++ b/models/activity/src/index.ts @@ -32,7 +32,6 @@ import { type IgnoreActivity, type Reaction, type SavedMessage, - type TxViewlet, type ReplyProvider } from '@hcengineering/activity' import contact, { type Person } from '@hcengineering/contact' @@ -93,21 +92,6 @@ export class TActivityAttributeUpdatesPresenter extends TClass implements Activi @Mixin(activity.mixin.IgnoreActivity, core.class.Class) export class TIgnoreActivity extends TClass implements IgnoreActivity {} -@Model(activity.class.TxViewlet, core.class.Doc, DOMAIN_MODEL) -export class TTxViewlet extends TDoc implements TxViewlet { - icon!: Asset - objectClass!: Ref> - txClass!: Ref> - // Component to display on. - component!: AnyComponent - // Filter - match?: DocumentQuery - label!: IntlString - display!: 'inline' | 'content' | 'emphasized' - editable!: boolean - hideOnRemove!: boolean -} - @Model(activity.class.ActivityMessage, core.class.AttachedDoc, DOMAIN_ACTIVITY) export class TActivityMessage extends TAttachedDoc implements ActivityMessage { @Prop(TypeBoolean(), activity.string.Pinned) @@ -267,7 +251,6 @@ export class TUserMentionInfo extends TAttachedDoc { export function createModel (builder: Builder): void { builder.createModel( - TTxViewlet, TActivityDoc, TActivityMessagesFilter, TActivityMessage, diff --git a/models/attachment/src/index.ts b/models/attachment/src/index.ts index df951c8ee5..46a400417b 100644 --- a/models/attachment/src/index.ts +++ b/models/attachment/src/index.ts @@ -97,34 +97,6 @@ export function createModel (builder: Builder): void { editor: attachment.component.Photos }) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: attachment.class.Attachment, - icon: attachment.icon.Attachment, - txClass: core.class.TxCreateDoc, - component: attachment.activity.TxAttachmentCreate, - label: attachment.string.AddAttachment, - display: 'emphasized' - }, - attachment.ids.TxAttachmentCreate - ) - - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: attachment.class.Attachment, - icon: attachment.icon.Attachment, - txClass: core.class.TxRemoveDoc, - component: attachment.activity.TxAttachmentCreate, - label: attachment.string.RemovedAttachment, - display: 'inline' - }, - attachment.ids.TxAttachmentRemove - ) - builder.createDoc( activity.class.DocUpdateMessageViewlet, core.space.Model, diff --git a/models/attachment/src/plugin.ts b/models/attachment/src/plugin.ts index 7370194f96..f62c50a8ab 100644 --- a/models/attachment/src/plugin.ts +++ b/models/attachment/src/plugin.ts @@ -13,7 +13,7 @@ // limitations under the License. // -import type { TxViewlet, ActivityMessage, DocUpdateMessageViewlet } from '@hcengineering/activity' +import type { ActivityMessage, DocUpdateMessageViewlet } from '@hcengineering/activity' import { attachmentId } from '@hcengineering/attachment' import attachment from '@hcengineering/attachment-resources/src/plugin' import type { Ref, Doc } from '@hcengineering/core' @@ -44,13 +44,10 @@ export default mergeIds(attachmentId, attachment, { ContentType: '' as IntlString }, ids: { - TxAttachmentCreate: '' as Ref, - TxAttachmentRemove: '' as Ref, AttachmentCreatedActivityViewlet: '' as Ref, AttachmentRemovedActivityViewlet: '' as Ref }, activity: { - TxAttachmentCreate: '' as AnyComponent, AttachmentsUpdatedMessage: '' as AnyComponent }, category: { diff --git a/models/calendar/src/index.ts b/models/calendar/src/index.ts index ea8735dcbd..c3a60be016 100644 --- a/models/calendar/src/index.ts +++ b/models/calendar/src/index.ts @@ -239,22 +239,6 @@ export function createModel (builder: Builder): void { calendar.ids.ReminderNotification ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: calendar.class.Event, - icon: calendar.icon.Reminder, - txClass: core.class.TxUpdateDoc, - label: calendar.string.Reminder, - component: calendar.activity.ReminderViewlet, - display: 'emphasized', - editable: false, - hideOnRemove: true - }, - calendar.ids.ReminderViewlet - ) - builder.createDoc( activity.class.DocUpdateMessageViewlet, core.space.Model, diff --git a/models/calendar/src/plugin.ts b/models/calendar/src/plugin.ts index 78980c5d22..c049c20f56 100644 --- a/models/calendar/src/plugin.ts +++ b/models/calendar/src/plugin.ts @@ -13,7 +13,7 @@ // limitations under the License. // -import { type DocUpdateMessageViewlet, type TxViewlet } from '@hcengineering/activity' +import { type DocUpdateMessageViewlet } from '@hcengineering/activity' import { calendarId } from '@hcengineering/calendar' import calendar from '@hcengineering/calendar-resources/src/plugin' import { type Ref } from '@hcengineering/core' @@ -65,7 +65,6 @@ export default mergeIds(calendarId, calendar, { CalendarEvent: '' as Ref }, ids: { - ReminderViewlet: '' as Ref, UpdateRemainderActivityViewlet: '' as Ref, CalendarNotificationGroup: '' as Ref } diff --git a/models/chunter/src/index.ts b/models/chunter/src/index.ts index cccbcb20ac..50ca4f942e 100644 --- a/models/chunter/src/index.ts +++ b/models/chunter/src/index.ts @@ -17,39 +17,30 @@ import activity, { type ActivityMessage } from '@hcengineering/activity' import { type Channel, chunterId, - type ChunterMessage, - type ChunterMessageExtension, type DirectMessage, - type Message, - type DirectMessageInput, type ChatMessage, type ChatMessageViewlet, type ChunterSpace, type ObjectChatPanel, type ThreadMessage } from '@hcengineering/chunter' -import contact, { type Person } from '@hcengineering/contact' +import contact from '@hcengineering/contact' import { - type Account, type Class, type Doc, type Domain, DOMAIN_MODEL, type Ref, - type Space, type Timestamp, IndexKind } from '@hcengineering/core' import { - ArrOf, type Builder, Collection as PropCollection, - Collection, Index, Mixin, Model, Prop, - ReadOnly, TypeMarkup, TypeRef, TypeString, @@ -57,11 +48,10 @@ import { UX } from '@hcengineering/model' import attachment from '@hcengineering/model-attachment' -import core, { TAttachedDoc, TClass, TDoc, TSpace } from '@hcengineering/model-core' +import core, { TClass, TDoc, TSpace } from '@hcengineering/model-core' import notification, { notificationActionTemplates } from '@hcengineering/model-notification' import view, { createAction, template, actionTemplates as viewTemplates } from '@hcengineering/model-view' import workbench from '@hcengineering/model-workbench' -import { type AnyComponent } from '@hcengineering/ui/src/types' import type { IntlString } from '@hcengineering/platform' import { TActivityMessage } from '@hcengineering/model-activity' @@ -73,10 +63,7 @@ export { chunterOperation } from './migration' export const DOMAIN_CHUNTER = 'chunter' as Domain @Model(chunter.class.ChunterSpace, core.class.Space) -export class TChunterSpace extends TSpace implements ChunterSpace { - @Prop(TypeTimestamp(), chunter.string.LastMessage) - lastMessage?: Timestamp -} +export class TChunterSpace extends TSpace implements ChunterSpace {} @Model(chunter.class.Channel, chunter.class.ChunterSpace) @UX(chunter.string.Channel, chunter.icon.Hashtag, undefined, undefined, undefined, chunter.string.Channels) @@ -90,50 +77,6 @@ export class TChannel extends TChunterSpace implements Channel { @UX(chunter.string.DirectMessage, contact.icon.Person, undefined, undefined, undefined, chunter.string.DirectMessages) export class TDirectMessage extends TChunterSpace implements DirectMessage {} -@Model(chunter.class.ChunterMessage, core.class.AttachedDoc, DOMAIN_CHUNTER) -export class TChunterMessage extends TAttachedDoc implements ChunterMessage { - @Prop(TypeMarkup(), chunter.string.Content) - @Index(IndexKind.FullText) - content!: string - - @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) - attachments?: number - - @Prop(TypeRef(core.class.Account), chunter.string.CreateBy) - @ReadOnly() - createBy!: Ref - - @Prop(TypeTimestamp(), chunter.string.Edit) - editedOn?: Timestamp - - @Prop(Collection(activity.class.Reaction), activity.string.Reactions) - reactions?: number -} - -@Mixin(chunter.mixin.ChunterMessageExtension, chunter.class.ChunterMessage) -export class TChunterMessageExtension extends TChunterMessage implements ChunterMessageExtension {} - -@Model(chunter.class.Message, chunter.class.ChunterMessage) -@UX(chunter.string.Message, undefined, 'MSG') -export class TMessage extends TChunterMessage implements Message { - declare attachedTo: Ref - - declare attachedToClass: Ref> - - @Prop(ArrOf(TypeRef(contact.class.Person)), chunter.string.Replies) - replies?: Ref[] - - repliesCount?: number - - @Prop(TypeTimestamp(), activity.string.LastReply) - lastReply?: Timestamp -} - -@Mixin(chunter.mixin.DirectMessageInput, core.class.Class) -export class TDirectMessageInput extends TClass implements DirectMessageInput { - component!: AnyComponent -} - @Model(chunter.class.ChatMessage, activity.class.ActivityMessage) @UX(chunter.string.Message, chunter.icon.Thread, undefined, undefined, undefined, chunter.string.Threads) export class TChatMessage extends TActivityMessage implements ChatMessage { @@ -206,11 +149,7 @@ export function createModel (builder: Builder): void { builder.createModel( TChunterSpace, TChannel, - TMessage, - TChunterMessage, - TChunterMessageExtension, TDirectMessage, - TDirectMessageInput, TChatMessage, TThreadMessage, TChatMessageViewlet, @@ -233,12 +172,6 @@ export function createModel (builder: Builder): void { encode: chunter.function.GetChunterSpaceLinkFragment }) - builder.mixin(spaceClass, core.class.Class, workbench.mixin.SpaceView, { - view: { - class: chunter.class.Message - } - }) - builder.mixin(spaceClass, core.class.Class, view.mixin.ObjectEditor, { editor: chunter.component.EditChannel }) @@ -248,10 +181,6 @@ export function createModel (builder: Builder): void { }) }) - builder.mixin(chunter.class.Message, core.class.Class, notification.mixin.ClassCollaborators, { - fields: ['createdBy', 'replies'] - }) - builder.mixin(chunter.class.DirectMessage, core.class.Class, view.mixin.ObjectTitle, { titleProvider: chunter.function.DirectTitleProvider }) @@ -276,22 +205,6 @@ export function createModel (builder: Builder): void { presenter: chunter.component.ChannelPreview }) - builder.mixin(chunter.class.DirectMessage, core.class.Class, chunter.mixin.DirectMessageInput, { - component: chunter.component.DirectMessageInput - }) - - builder.mixin(chunter.class.Message, core.class.Class, notification.mixin.NotificationObjectPresenter, { - presenter: chunter.component.ThreadParentPresenter - }) - - builder.mixin(chunter.class.Message, core.class.Class, view.mixin.ObjectPanel, { - component: chunter.component.ThreadViewPanel - }) - - builder.mixin(chunter.class.Message, core.class.Class, view.mixin.ObjectPresenter, { - presenter: chunter.component.MessagePresenter - }) - builder.mixin(chunter.class.Channel, core.class.Class, view.mixin.ObjectPresenter, { presenter: chunter.component.ChannelPresenter }) @@ -438,10 +351,6 @@ export function createModel (builder: Builder): void { chunter.action.CopyChatMessageLink ) - builder.mixin(chunter.class.ChunterMessage, core.class.Class, view.mixin.ClassFilters, { - filters: ['space', '_class'] - }) - builder.mixin(chunter.class.Channel, core.class.Class, view.mixin.ClassFilters, { filters: [] }) diff --git a/models/chunter/src/migration.ts b/models/chunter/src/migration.ts index de25f0b5c8..798a2fc86b 100644 --- a/models/chunter/src/migration.ts +++ b/models/chunter/src/migration.ts @@ -21,7 +21,8 @@ import core, { type Doc, type Domain, type Ref, - type Space + type Space, + DOMAIN_TX } from '@hcengineering/core' import { tryMigrate, @@ -35,6 +36,7 @@ import notification from '@hcengineering/notification' import contactPlugin, { type PersonAccount } from '@hcengineering/contact' import chunter from './plugin' +import { DOMAIN_CHUNTER } from './index' export const DOMAIN_COMMENT = 'comment' as Domain @@ -175,6 +177,21 @@ async function removeBacklinks (client: MigrationClient): Promise { }) } +async function removeOldClasses (client: MigrationClient): Promise { + const classes = [ + 'chunter:class:ChunterMessage', + 'chunter:class:Message', + 'chunter:class:Comment', + 'chunter:class:Backlink' + ] as Ref>[] + + for (const _class of classes) { + await client.deleteMany(DOMAIN_CHUNTER, { _class }) + await client.deleteMany(DOMAIN_TX, { objectClass: _class }) + await client.deleteMany(DOMAIN_TX, { 'tx.objectClass': _class }) + } +} + export const chunterOperation: MigrateOperation = { async migrate (client: MigrationClient): Promise { await tryMigrate(client, chunterId, [ @@ -207,6 +224,12 @@ export const chunterOperation: MigrateOperation = { (msg) => (msg as ThreadMessage).objectClass ) } + }, + { + state: 'remove-old-classes', + func: async (client) => { + await removeOldClasses(client) + } } ]) }, diff --git a/models/chunter/src/plugin.ts b/models/chunter/src/plugin.ts index 97e045127d..6c5f131bda 100644 --- a/models/chunter/src/plugin.ts +++ b/models/chunter/src/plugin.ts @@ -13,7 +13,7 @@ // limitations under the License. // -import type { ActivityMessage, TxViewlet } from '@hcengineering/activity' +import type { ActivityMessage } from '@hcengineering/activity' import { chunterId, type Channel } from '@hcengineering/chunter' import chunter from '@hcengineering/chunter-resources/src/plugin' import { type Client, type Doc, type Ref } from '@hcengineering/core' @@ -26,8 +26,6 @@ import type { Action, ActionCategory, ViewAction, Viewlet, ViewletDescriptor } f export default mergeIds(chunterId, chunter, { component: { ChannelPresenter: '' as AnyComponent, - DirectMessagePresenter: '' as AnyComponent, - MessagePresenter: '' as AnyComponent, DmPresenter: '' as AnyComponent, ChannelsPanel: '' as AnyComponent, Chat: '' as AnyComponent, @@ -80,17 +78,8 @@ export default mergeIds(chunterId, chunter, { Channels: '' as Ref }, ids: { - TxCommentCreate: '' as Ref, - TxCommentRemove: '' as Ref, - TxMessageCreate: '' as Ref, - TxChatMessageCreate: '' as Ref, - TxChatMessageRemove: '' as Ref, ChunterNotificationGroup: '' as Ref }, - activity: { - TxCommentCreate: '' as AnyComponent, - TxMessageCreate: '' as AnyComponent - }, space: { General: '' as Ref, Random: '' as Ref diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index b29dc517da..2f573809f2 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -376,15 +376,6 @@ export function createModel (builder: Builder): void { index: 100 }) - builder.createDoc(activity.class.TxViewlet, core.space.Model, { - objectClass: contact.class.Person, - icon: contact.icon.Person, - txClass: core.class.TxUpdateDoc, - labelComponent: contact.activity.TxNameChange, - display: 'inline', - match: { 'operations.name': { $exists: true } } - }) - builder.createDoc(activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: contact.class.Person, action: 'update', diff --git a/models/contact/src/plugin.ts b/models/contact/src/plugin.ts index 3b2f2ec9e8..4fce9257e1 100644 --- a/models/contact/src/plugin.ts +++ b/models/contact/src/plugin.ts @@ -27,7 +27,6 @@ import { type ChatMessageViewlet } from '@hcengineering/chunter' export default mergeIds(contactId, contact, { activity: { - TxNameChange: '' as AnyComponent, NameChangedActivityMessage: '' as AnyComponent }, component: { diff --git a/models/controlled-documents/src/index.ts b/models/controlled-documents/src/index.ts index 421d3d1b8b..2213219cc5 100644 --- a/models/controlled-documents/src/index.ts +++ b/models/controlled-documents/src/index.ts @@ -244,21 +244,6 @@ export function createModel (builder: Builder): void { ) // Workflow - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: documents.class.DocumentRequest, - icon: request.icon.Requests, - txClass: core.class.TxCreateDoc, - component: request.activity.TxCreateRequest, - label: request.string.CreatedRequest, - labelComponent: request.activity.RequestLabel, - display: 'emphasized' - }, - request.ids.TxRequestCreate - ) - builder.createDoc( view.class.Viewlet, core.space.Model, diff --git a/models/gmail/src/index.ts b/models/gmail/src/index.ts index e320a7d45e..98c9fe2c04 100644 --- a/models/gmail/src/index.ts +++ b/models/gmail/src/index.ts @@ -162,20 +162,6 @@ export function createModel (builder: Builder): void { gmail.integrationType.Gmail ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: gmail.class.Message, - icon: contact.icon.Email, - txClass: core.class.TxCreateDoc, - label: gmail.string.HaveWrittenEmail, - labelComponent: gmail.activity.TxWriteMessage, - display: 'inline' - }, - gmail.ids.TxSharedCreate - ) - builder.createDoc( activity.class.DocUpdateMessageViewlet, core.space.Model, @@ -189,22 +175,6 @@ export function createModel (builder: Builder): void { gmail.ids.GmailWriteMessageActivityViewlet ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: gmail.class.SharedMessages, - icon: contact.icon.Email, - txClass: core.class.TxCreateDoc, - component: gmail.activity.TxSharedCreate, - label: gmail.string.SharedMessages, - display: 'content', - editable: true, - hideOnRemove: true - }, - gmail.ids.TxSharedCreate - ) - builder.createDoc( activity.class.DocUpdateMessageViewlet, core.space.Model, @@ -272,24 +242,6 @@ export function createModel (builder: Builder): void { gmail.ids.EmailNotification ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: gmail.class.Message, - icon: contact.icon.Email, - txClass: core.class.TxCreateDoc, - match: { - 'attributes.incoming': true - }, - label: gmail.string.NewIncomingMessage, - display: 'inline', - editable: false, - hideOnRemove: true - }, - gmail.ids.NewMessageNotification - ) - builder.mixin(gmail.class.Message, core.class.Class, core.mixin.FullTextSearchContext, { parentPropagate: false }) diff --git a/models/gmail/src/plugin.ts b/models/gmail/src/plugin.ts index f8721c76d8..6db94b7ae3 100644 --- a/models/gmail/src/plugin.ts +++ b/models/gmail/src/plugin.ts @@ -19,7 +19,7 @@ import { type IntlString, mergeIds, type Resource } from '@hcengineering/platfor import { gmailId } from '@hcengineering/gmail' import gmail from '@hcengineering/gmail-resources/src/plugin' import type { AnyComponent } from '@hcengineering/ui/src/types' -import type { DocUpdateMessageViewlet, TxViewlet } from '@hcengineering/activity' +import type { DocUpdateMessageViewlet } from '@hcengineering/activity' import { type Action } from '@hcengineering/view' import { type NotificationGroup } from '@hcengineering/notification' @@ -43,15 +43,11 @@ export default mergeIds(gmailId, gmail, { ConfigDescription: '' as IntlString }, ids: { - TxSharedCreate: '' as Ref, - NewMessageNotification: '' as Ref, EmailNotificationGroup: '' as Ref, GmailSharedMessageActivityViewlet: '' as Ref, GmailWriteMessageActivityViewlet: '' as Ref }, activity: { - TxSharedCreate: '' as AnyComponent, - TxWriteMessage: '' as AnyComponent, GmailSharedMessage: '' as AnyComponent, GmailWriteMessage: '' as AnyComponent }, diff --git a/models/notification/src/index.ts b/models/notification/src/index.ts index f3e3045f24..3b4c0302fb 100644 --- a/models/notification/src/index.ts +++ b/models/notification/src/index.ts @@ -32,7 +32,8 @@ import { type Ref, type Space, type Timestamp, - type Tx + type Tx, + type IndexingConfiguration } from '@hcengineering/core' import { ArrOf, @@ -61,8 +62,6 @@ import { type CommonInboxNotification, type CommonNotificationType, type DocNotifyContext, - type DocUpdateTx, - type DocUpdates, type InboxNotification, type MentionInboxNotification, type NotificationContextPresenter, @@ -78,7 +77,7 @@ import { type PushSubscription, type PushSubscriptionKeys } from '@hcengineering/notification' -import { getEmbeddedLabel, type Asset, type IntlString, type Resource } from '@hcengineering/platform' +import { type Asset, type IntlString, type Resource } from '@hcengineering/platform' import setting from '@hcengineering/setting' import { type AnyComponent, type Location } from '@hcengineering/ui/src/types' @@ -185,25 +184,6 @@ export class TNotificationContextPresenter extends TClass implements Notificatio labelPresenter?: AnyComponent } -@Model(notification.class.DocUpdates, core.class.Doc, DOMAIN_NOTIFICATION) -export class TDocUpdates extends TDoc implements DocUpdates { - @Prop(TypeRef(core.class.Account), core.string.Account) - @Index(IndexKind.Indexed) - user!: Ref - - @Prop(TypeRef(core.class.Account), core.string.AttachedTo) - @Index(IndexKind.Indexed) - attachedTo!: Ref - - @Prop(TypeRef(core.class.Account), getEmbeddedLabel('Hidden')) - // @Index(IndexKind.Indexed) - hidden!: boolean - - attachedToClass!: Ref> - lastTxTime?: Timestamp - txes!: DocUpdateTx[] -} - @Model(notification.class.DocNotifyContext, core.class.Doc, DOMAIN_NOTIFICATION) export class TDocNotifyContext extends TDoc implements DocNotifyContext { @Prop(TypeRef(core.class.Account), core.string.Account) @@ -339,7 +319,6 @@ export function createModel (builder: Builder): void { TNotificationPreferencesGroup, TClassCollaborators, TCollaborators, - TDocUpdates, TNotificationObjectPresenter, TNotificationPreview, TDocNotifyContext, @@ -455,36 +434,6 @@ export function createModel (builder: Builder): void { notification.ids.CollaboratoAddNotification ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: notification.mixin.Collaborators, - icon: notification.icon.Notifications, - txClass: core.class.TxMixin, - component: notification.activity.TxCollaboratorsChange, - display: 'inline', - editable: false, - hideOnRemove: true - }, - notification.ids.TxCollaboratorsChange - ) - - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: chunter.class.DirectMessage, - icon: chunter.icon.Chunter, - txClass: core.class.TxCreateDoc, - component: notification.activity.TxDmCreation, - display: 'inline', - editable: false, - hideOnRemove: true - }, - notification.ids.TxDmCreation - ) - builder.createDoc(notification.class.ActivityNotificationViewlet, core.space.Model, { presenter: notification.component.NotificationCollaboratorsChanged, messageMatch: { @@ -688,6 +637,16 @@ export function createModel (builder: Builder): void { indexes: [{ user: 1, archived: 1 }], disabled: [{ modifiedOn: 1 }, { modifiedBy: 1 }, { createdBy: 1 }, { isViewed: 1 }, { hidden: 1 }] }) + + builder.mixin, IndexingConfiguration>( + notification.class.DocNotifyContext, + core.class.Class, + core.mixin.IndexConfiguration, + { + searchDisabled: true, + indexes: [] + } + ) } export function generateClassNotificationTypes ( diff --git a/models/notification/src/migration.ts b/models/notification/src/migration.ts index 76035934e9..5001f762e4 100644 --- a/models/notification/src/migration.ts +++ b/models/notification/src/migration.ts @@ -13,20 +13,7 @@ // limitations under the License. // -import activity, { type ActivityMessage, type DocUpdateMessage } from '@hcengineering/activity' -import { - DOMAIN_TX, - TxProcessor, - generateId, - type AttachedDoc, - type Doc, - type Domain, - type Ref, - type TxCUD, - type TxCollectionCUD, - type Class, - type DocumentQuery -} from '@hcengineering/core' +import { type Doc, type Ref, type Class, type DocumentQuery, DOMAIN_TX } from '@hcengineering/core' import { createDefaultSpace, tryMigrate, @@ -35,189 +22,10 @@ import { type MigrationClient, type MigrationUpgradeClient } from '@hcengineering/model' -import notification, { - notificationId, - type ActivityInboxNotification, - type DocNotifyContext, - type DocUpdateTx, - type DocUpdates -} from '@hcengineering/notification' +import notification, { notificationId, type DocNotifyContext } from '@hcengineering/notification' import { DOMAIN_NOTIFICATION } from './index' -interface InboxData { - context: DocNotifyContext - notifications: ActivityInboxNotification[] -} - -const DOMAIN_ACTIVITY = 'activity' as Domain - -async function getActivityMessages ( - client: MigrationClient, - contexts: { - context: DocNotifyContext - txes: DocUpdateTx[] - }[] -): Promise { - const result: ActivityInboxNotification[] = [] - const txes = contexts.flatMap((it) => it.txes) - const docUpdateMessages = await client.find(DOMAIN_ACTIVITY, { - _class: activity.class.DocUpdateMessage, - txId: { $in: txes.map((it) => it._id) }, - attachedTo: { $in: contexts.map((it) => it.context.attachedTo) } - }) - - if (docUpdateMessages.length > 0) { - docUpdateMessages.forEach((message) => { - const ctx = contexts.find((it) => it.context.attachedTo === message.attachedTo) - if (ctx === undefined) { - return - } - const tx = ctx.txes.find((it) => it._id === (message.txId as any)) - if (tx == null) { - return - } - result.push({ - _id: generateId(), - _class: notification.class.ActivityInboxNotification, - space: ctx.context.space, - user: ctx.context.user, - isViewed: !tx.isNew, - attachedTo: message._id, - attachedToClass: message._class, - docNotifyContext: ctx.context._id, - title: tx.title, - body: tx.body, - intlParams: tx.intlParams, - intlParamsNotLocalized: tx.intlParamsNotLocalized, - modifiedOn: tx.modifiedOn, - modifiedBy: tx.modifiedBy, - createdOn: tx.modifiedOn, - createdBy: tx.modifiedBy - }) - }) - } - - const originTx: TxCUD[] = await client.find>(DOMAIN_TX, { _id: { $in: txes.map((it) => it._id) } }) - - if (originTx.length === 0) { - return result - } - - const innerTx = originTx.map((it) => TxProcessor.extractTx(it as TxCollectionCUD) as TxCUD) - - ;( - await client.find(DOMAIN_ACTIVITY, { - _id: { $in: innerTx.map((it) => it.objectId as Ref) } - }) - ) - .filter(({ _class }) => client.hierarchy.isDerived(_class, activity.class.ActivityMessage)) - .forEach((message) => { - const tx = originTx.find((q) => (TxProcessor.extractTx(q) as TxCUD).objectId === message._id) - if (tx == null) { - return - } - - const ctx = contexts.find((it) => it.context.attachedTo === message.attachedTo) - if (ctx === undefined) { - return - } - const docTx = ctx.txes.find((it) => it._id === tx._id) - if (docTx == null) { - return - } - result.push({ - _id: generateId(), - _class: notification.class.ActivityInboxNotification, - space: ctx.context.space, - user: ctx.context.user, - isViewed: !docTx.isNew, - attachedTo: message._id, - attachedToClass: message._class, - docNotifyContext: ctx.context._id, - title: docTx.title, - body: docTx.body, - intlParams: docTx.intlParams, - intlParamsNotLocalized: docTx.intlParamsNotLocalized, - modifiedOn: docTx.modifiedOn, - modifiedBy: docTx.modifiedBy, - createdOn: docTx.modifiedOn, - createdBy: docTx.modifiedBy - }) - }) - return result -} - -async function getInboxData (client: MigrationClient, docUpdates: DocUpdates[]): Promise { - const toProcess = docUpdates.filter((it) => !it.hidden && client.hierarchy.hasClass(it.attachedToClass)) - - const contexts = toProcess.map((docUpdate) => { - const newTxIndex = docUpdate.txes.findIndex(({ isNew }) => isNew) - - const context: DocNotifyContext = { - _id: docUpdate._id, - _class: notification.class.DocNotifyContext, - space: docUpdate.space, - user: docUpdate.user, - attachedTo: docUpdate.attachedTo, - attachedToClass: docUpdate.attachedToClass, - hidden: docUpdate.hidden, - lastViewedTimestamp: newTxIndex !== -1 ? docUpdate.txes[newTxIndex - 1]?.modifiedOn : docUpdate.lastTxTime, - lastUpdateTimestamp: docUpdate.lastTxTime, - modifiedBy: docUpdate.modifiedBy, - modifiedOn: docUpdate.modifiedOn, - createdBy: docUpdate.createdBy, - createdOn: docUpdate.createdOn - } - - return { - context, - txes: docUpdate.txes - } - }) - - const notifications = await getActivityMessages(client, contexts) - return contexts.map((it) => ({ - context: it.context, - notifications: notifications.filter((nit) => nit.docNotifyContext === it.context._id) - })) -} - -async function migrateInboxNotifications (client: MigrationClient): Promise { - let processing = 0 - while (true) { - const docUpdates = await client.find( - DOMAIN_NOTIFICATION, - { - _class: notification.class.DocUpdates - }, - { limit: 1000 } - ) - - console.log('notifications processing:', processing) - - if (docUpdates.length === 0) { - return - } - - processing += docUpdates.length - - const data: InboxData[] = (await getInboxData(client, docUpdates)).filter( - (data): data is InboxData => data !== undefined - ) - - await client.deleteMany(DOMAIN_NOTIFICATION, { _id: { $in: docUpdates.map(({ _id }) => _id) } }) - await client.create( - DOMAIN_NOTIFICATION, - data.map(({ context }) => context) - ) - await client.create( - DOMAIN_NOTIFICATION, - data.flatMap(({ notifications }) => notifications) - ) - } -} - export async function removeNotifications ( client: MigrationClient, query: DocumentQuery @@ -262,12 +70,6 @@ export async function removeNotifications ( export const notificationOperation: MigrateOperation = { async migrate (client: MigrationClient): Promise { - await tryMigrate(client, notificationId, [ - { - state: 'inbox-notifications', - func: migrateInboxNotifications - } - ]) await tryMigrate(client, notificationId, [ { state: 'delete-hidden-notifications', @@ -284,6 +86,15 @@ export const notificationOperation: MigrateOperation = { } } ]) + await tryMigrate(client, notificationId, [ + { + state: 'remove-old-classes', + func: async (client) => { + await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:DocUpdates' as Ref> }) + await client.deleteMany(DOMAIN_TX, { objectClass: 'notification:class:DocUpdates' as Ref> }) + } + } + ]) }, async upgrade (client: MigrationUpgradeClient): Promise { await tryUpgrade(client, notificationId, [ diff --git a/models/notification/src/plugin.ts b/models/notification/src/plugin.ts index 24bcc9dff8..7ff1fc5261 100644 --- a/models/notification/src/plugin.ts +++ b/models/notification/src/plugin.ts @@ -20,7 +20,7 @@ import { type IntlString, type Resource, mergeIds } from '@hcengineering/platfor import { type AnyComponent } from '@hcengineering/ui/src/types' import { type Action, type ActionCategory, type ViewAction } from '@hcengineering/view' import { type Application } from '@hcengineering/workbench' -import { type DocUpdateMessageViewlet, type TxViewlet } from '@hcengineering/activity' +import { type DocUpdateMessageViewlet } from '@hcengineering/activity' export default mergeIds(notificationId, notification, { string: { @@ -41,12 +41,7 @@ export default mergeIds(notificationId, notification, { Notification: '' as Ref, Inbox: '' as Ref }, - activity: { - TxDmCreation: '' as AnyComponent - }, ids: { - TxCollaboratorsChange: '' as Ref, - TxDmCreation: '' as Ref, CollaboratorsChangedMessage: '' as Ref }, component: { diff --git a/models/request/src/index.ts b/models/request/src/index.ts index 81c2e59698..2634bb6b64 100644 --- a/models/request/src/index.ts +++ b/models/request/src/index.ts @@ -151,20 +151,6 @@ export function createModel (builder: Builder): void { ['comments', 'approved', 'rejected', 'status'] ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: request.class.Request, - icon: request.icon.Requests, - txClass: core.class.TxCreateDoc, - component: request.activity.TxCreateRequest, - label: request.string.CreatedRequest, - labelComponent: request.activity.RequestLabel, - display: 'emphasized' - }, - request.ids.TxRequestCreate - ) builder.createDoc(core.class.DomainIndexConfiguration, core.space.Model, { domain: DOMAIN_REQUEST, disabled: [ diff --git a/models/request/src/plugin.ts b/models/request/src/plugin.ts index 002ab08997..2726dc8275 100644 --- a/models/request/src/plugin.ts +++ b/models/request/src/plugin.ts @@ -19,20 +19,14 @@ import { mergeIds } from '@hcengineering/platform' import { requestId } from '@hcengineering/request' import request from '@hcengineering/request-resources/src/plugin' import { type AnyComponent } from '@hcengineering/ui/src/types' -import type { TxViewlet } from '@hcengineering/activity' import type { NotificationGroup, NotificationType } from '@hcengineering/notification' export default mergeIds(requestId, request, { - activity: { - TxCreateRequest: '' as AnyComponent, - RequestLabel: '' as AnyComponent - }, component: { EditRequest: '' as AnyComponent, NotificationRequestView: '' as AnyComponent }, ids: { - TxRequestCreate: '' as Ref, RequestNotificationGroup: '' as Ref, CreateRequestNotification: '' as Ref }, diff --git a/models/setting/src/index.ts b/models/setting/src/index.ts index b475427a71..b4fae18635 100644 --- a/models/setting/src/index.ts +++ b/models/setting/src/index.ts @@ -355,22 +355,6 @@ export function createModel (builder: Builder): void { setting.ids.SettingApp ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: setting.class.Integration, - icon: setting.icon.Integrations, - txClass: core.class.TxUpdateDoc, - label: setting.string.IntegrationWith, - labelComponent: setting.activity.TxIntegrationDisable, - display: 'inline', - editable: false, - hideOnRemove: true - }, - setting.ids.TxIntegrationDisable - ) - builder.createDoc( activity.class.DocUpdateMessageViewlet, core.space.Model, diff --git a/models/setting/src/plugin.ts b/models/setting/src/plugin.ts index ccaa9cb339..cab8996498 100644 --- a/models/setting/src/plugin.ts +++ b/models/setting/src/plugin.ts @@ -13,7 +13,7 @@ // limitations under the License. // -import type { DocUpdateMessageViewlet, TxViewlet } from '@hcengineering/activity' +import type { DocUpdateMessageViewlet } from '@hcengineering/activity' import { type Doc, type Ref } from '@hcengineering/core' import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' import { settingId } from '@hcengineering/setting' @@ -24,11 +24,7 @@ import { type TemplateFieldFunc } from '@hcengineering/templates' import { type NotificationGroup, type NotificationType } from '@hcengineering/notification' export default mergeIds(settingId, setting, { - activity: { - TxIntegrationDisable: '' as AnyComponent - }, ids: { - TxIntegrationDisable: '' as Ref, EnumSetting: '' as Ref, Configure: '' as Ref, SettingNotificationGroup: '' as Ref, diff --git a/models/telegram/src/index.ts b/models/telegram/src/index.ts index 2607ed667f..400fc9f181 100644 --- a/models/telegram/src/index.ts +++ b/models/telegram/src/index.ts @@ -123,19 +123,6 @@ export function createModel (builder: Builder): void { telegram.templateField.IntegrationOwnerTG ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: telegram.class.Message, - icon: contact.icon.Telegram, - txClass: core.class.TxCreateDoc, - component: telegram.activity.TxMessage, - display: 'inline' - }, - telegram.ids.TxMessage - ) - builder.createDoc( activity.class.DocUpdateMessageViewlet, core.space.Model, @@ -177,22 +164,6 @@ export function createModel (builder: Builder): void { telegram.integrationType.Telegram ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: telegram.class.SharedMessages, - icon: contact.icon.Telegram, - txClass: core.class.TxCreateDoc, - component: telegram.activity.TxSharedCreate, - label: telegram.string.SharedMessages, - display: 'content', - editable: true, - hideOnRemove: true - }, - telegram.ids.TxSharedCreate - ) - builder.createDoc( activity.class.DocUpdateMessageViewlet, core.space.Model, @@ -235,24 +206,6 @@ export function createModel (builder: Builder): void { telegram.ids.NewMessageNotification ) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: telegram.class.Message, - icon: contact.icon.Telegram, - txClass: core.class.TxCreateDoc, - match: { - 'attributes.incoming': true - }, - label: telegram.string.NewIncomingMessage, - display: 'inline', - editable: false, - hideOnRemove: true - }, - telegram.ids.NewMessageNotificationViewlet - ) - builder.mixin(telegram.class.Message, core.class.Class, core.mixin.FullTextSearchContext, { parentPropagate: false, childProcessingAllowed: true diff --git a/models/telegram/src/plugin.ts b/models/telegram/src/plugin.ts index d0e905c9b9..aebb87d272 100644 --- a/models/telegram/src/plugin.ts +++ b/models/telegram/src/plugin.ts @@ -19,7 +19,7 @@ import { type IntlString, type Resource, mergeIds } from '@hcengineering/platfor import { telegramId } from '@hcengineering/telegram' import telegram from '@hcengineering/telegram-resources/src/plugin' import type { AnyComponent } from '@hcengineering/ui/src/types' -import type { DocUpdateMessageViewlet, TxViewlet } from '@hcengineering/activity' +import type { DocUpdateMessageViewlet } from '@hcengineering/activity' import { type TemplateFieldFunc } from '@hcengineering/templates' import { type NotificationGroup } from '@hcengineering/notification' @@ -39,9 +39,6 @@ export default mergeIds(telegramId, telegram, { NewIncomingMessage: '' as IntlString }, ids: { - TxMessage: '' as Ref, - TxSharedCreate: '' as Ref, - NewMessageNotificationViewlet: '' as Ref, NotificationGroup: '' as Ref, TelegramMessageSharedActivityViewlet: '' as Ref, TelegramMessageCreatedActivityViewlet: '' as Ref @@ -51,8 +48,6 @@ export default mergeIds(telegramId, telegram, { GetIntegrationOwnerTG: '' as Resource }, activity: { - TxMessage: '' as AnyComponent, - TxSharedCreate: '' as AnyComponent, TelegramMessageCreated: '' as AnyComponent } }) diff --git a/models/time/src/plugin.ts b/models/time/src/plugin.ts index a16ac08f40..76c8e0c0e2 100644 --- a/models/time/src/plugin.ts +++ b/models/time/src/plugin.ts @@ -21,7 +21,6 @@ import { type Action, type ActionCategory } from '@hcengineering/view' import { timeId } from '@hcengineering/time' import time from '@hcengineering/time-resources/src/plugin' import { type NotificationGroup, type NotificationType } from '@hcengineering/notification' -import { type TxViewlet } from '@hcengineering/activity' export default mergeIds(timeId, time, { action: { @@ -59,8 +58,7 @@ export default mergeIds(timeId, time, { }, ids: { TimeNotificationGroup: '' as Ref, - ToDoCreated: '' as Ref, - TxToDoCreated: '' as Ref + ToDoCreated: '' as Ref }, function: { ToDoTitleProvider: '' as Resource<(client: Client, ref: Ref, doc?: Doc) => Promise> diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index a46665f7bb..5840b623f5 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -540,19 +540,6 @@ export function createModel (builder: Builder): void { component: tracker.component.EditIssueTemplate }) - builder.createDoc( - activity.class.TxViewlet, - core.space.Model, - { - objectClass: tracker.class.Issue, - icon: tracker.icon.Issue, - txClass: core.class.TxCreateDoc, - labelComponent: tracker.activity.TxIssueCreated, - display: 'inline' - }, - tracker.ids.TxIssueCreated - ) - builder.createDoc( activity.class.DocUpdateMessageViewlet, core.space.Model, diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index 7f5e01b46c..927a6109c7 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -import { type DocUpdateMessageViewlet, type TxViewlet } from '@hcengineering/activity' +import { type DocUpdateMessageViewlet } from '@hcengineering/activity' import { type ChatMessageViewlet } from '@hcengineering/chunter' import { type StatusCategory, type Doc, type Ref } from '@hcengineering/core' import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/model-presentation' @@ -48,7 +48,6 @@ export default mergeIds(trackerId, tracker, { Extensions: '' as IntlString }, activity: { - TxIssueCreated: '' as AnyComponent, StatusIcon: '' as AnyComponent, PriorityIcon: '' as AnyComponent }, @@ -77,7 +76,6 @@ export default mergeIds(trackerId, tracker, { ProjectList: '' as Ref }, ids: { - TxIssueCreated: '' as Ref, TrackerNotificationGroup: '' as Ref, AssigneeNotification: '' as Ref, BaseProjectType: '' as Ref, diff --git a/plugins/activity-resources/src/activity.ts b/plugins/activity-resources/src/activity.ts index 441f27cbee..cc420fdf01 100644 --- a/plugins/activity-resources/src/activity.ts +++ b/plugins/activity-resources/src/activity.ts @@ -1,58 +1,8 @@ -import activity, { type DisplayTx, type SavedMessage } from '@hcengineering/activity' -import core, { - type Class, - type Doc, - type Hierarchy, - type Ref, - SortingOrder, - type Tx, - type TxCreateDoc, - type TxCUD, - type TxMixin, - TxProcessor, - type TxUpdateDoc, - type WithLookup -} from '@hcengineering/core' +import activity, { type SavedMessage } from '@hcengineering/activity' +import { SortingOrder, type WithLookup } from '@hcengineering/core' import { writable } from 'svelte/store' import { createQuery, getClient } from '@hcengineering/presentation' -// TODO: remove old code -/** - * @public - */ -export type ActivityKey = string - -/** - * @public - */ -// TODO: remove old code -export function activityKey (objectClass: Ref>, txClass: Ref>): ActivityKey { - return objectClass + ':' + txClass -} - -// TODO: remove old code -export function newDisplayTx ( - tx: TxCUD, - hierarchy: Hierarchy, - isOwnTx: boolean, - originTx: TxCUD = tx -): DisplayTx { - const createTx = hierarchy.isDerived(tx._class, core.class.TxCreateDoc) ? (tx as TxCreateDoc) : undefined - return { - tx, - isOwnTx, - txes: [], - createTx, - updateTx: hierarchy.isDerived(tx._class, core.class.TxUpdateDoc) ? (tx as TxUpdateDoc) : undefined, - updated: false, - removed: false, - mixin: false, - mixinTx: hierarchy.isDerived(tx._class, core.class.TxMixin) ? (tx as TxMixin) : undefined, - doc: createTx !== undefined ? TxProcessor.createDoc2Doc(createTx) : undefined, - originTx - } -} - export const savedMessagesStore = writable>>([]) const savedMessagesQuery = createQuery(true) diff --git a/plugins/activity-resources/src/utils.ts b/plugins/activity-resources/src/utils.ts index 058c7f49f5..22a313915e 100644 --- a/plugins/activity-resources/src/utils.ts +++ b/plugins/activity-resources/src/utils.ts @@ -1,411 +1,14 @@ import { get } from 'svelte/store' -import type { ActivityMessage, DisplayTx, Reaction, TxViewlet } from '@hcengineering/activity' -import core, { - type AttachedDoc, - type Class, - type Client, - type Collection, - type Doc, - type Hierarchy, - type Obj, - type Ref, - type TxCUD, - type TxCollectionCUD, - type TxCreateDoc, - type TxMixin, - type TxOperations, - TxProcessor, - type TxUpdateDoc, - matchQuery, - getCurrentAccount, - isOtherHour -} from '@hcengineering/core' -import { type Asset, type IntlString, getResource, translate } from '@hcengineering/platform' -import { getAttributePresenterClass, getClient } from '@hcengineering/presentation' -import { - type AnyComponent, - type AnySvelteComponent, - ErrorPresenter, - themeStore, - type Location, - getEventPositionElement, - closePopup, - showPopup, - EmojiPopup -} from '@hcengineering/ui' -import view, { type AttributeModel, type BuildModelKey, type BuildModelOptions } from '@hcengineering/view' -import { getObjectPresenter } from '@hcengineering/view-resources' +import type { ActivityMessage, Reaction } from '@hcengineering/activity' +import core, { type Doc, type Ref, type TxOperations, getCurrentAccount, isOtherHour } from '@hcengineering/core' +import { getClient } from '@hcengineering/presentation' +import { type Location, getEventPositionElement, closePopup, showPopup, EmojiPopup } from '@hcengineering/ui' +import { type AttributeModel } from '@hcengineering/view' import preference from '@hcengineering/preference' -import { type ActivityKey, activityKey, savedMessagesStore } from './activity' +import { savedMessagesStore } from './activity' import activity from './plugin' -const valueTypes: ReadonlyArray>> = [ - core.class.TypeString, - core.class.EnumOf, - core.class.TypeNumber, - core.class.TypeDate, - core.class.TypeMarkup, - core.class.TypeCollaborativeMarkup -] - -export type TxDisplayViewlet = - | (Pick & { - component?: AnyComponent | AnySvelteComponent - pseudo: boolean - }) - | undefined - -async function createPseudoViewlet ( - client: TxOperations, - dtx: DisplayTx, - label: IntlString, - display: 'inline' | 'content' | 'emphasized' = 'inline' -): Promise { - const docClass: Class = client.getModel().getObject(dtx.tx.objectClass) - - const language = get(themeStore).language - let trLabel = docClass.label !== undefined ? await translate(docClass.label, {}, language) : undefined - if (dtx.collectionAttribute !== undefined) { - const itemLabel = (dtx.collectionAttribute.type as Collection).itemLabel - if (itemLabel !== undefined) { - trLabel = await translate(itemLabel, {}, language) - } - } - - // Check if it is attached doc and collection have title override. - const presenter = await getObjectPresenter(client, dtx.tx.objectClass, { key: 'doc-presenter' }, false, false) - if (presenter !== undefined) { - let collection = '' - if (dtx.collectionAttribute?.label !== undefined) { - collection = await translate(dtx.collectionAttribute.label, {}, language) - } - return { - display, - icon: docClass.icon ?? activity.icon.Activity, - label, - labelParams: { - _class: trLabel, - collection - }, - component: presenter.presenter, - pseudo: true - } - } -} - -export function getDTxProps (dtx: DisplayTx): any { - return { tx: dtx.tx, value: dtx.doc, isOwnTx: dtx.isOwnTx, prevValue: dtx.prevDoc } -} - -function getViewlet ( - viewlets: Map, - dtx: DisplayTx, - hierarchy: Hierarchy -): TxDisplayViewlet | undefined { - let key: string - if (dtx.mixinTx?.mixin !== undefined && dtx.tx._id === dtx.mixinTx._id) { - key = activityKey(dtx.mixinTx.mixin, dtx.tx._class) - } else { - key = activityKey(dtx.tx.objectClass, dtx.tx._class) - } - const vl = viewlets.get(key) - if (vl !== undefined) { - for (const viewlet of vl) { - if (viewlet.match === undefined) { - return { ...viewlet, pseudo: false } - } - const res = matchQuery([dtx.tx], viewlet.match, dtx.tx._class, hierarchy) - if (res.length > 0) { - return { ...viewlet, pseudo: false } - } - } - } -} - -export async function updateViewlet ( - client: TxOperations, - viewlets: Map, - dtx: DisplayTx -): Promise<{ - viewlet: TxDisplayViewlet - id: Ref> - model: AttributeModel[] - props: any - modelIcon: Asset | undefined - iconComponent: AnyComponent | undefined - }> { - let viewlet = getViewlet(viewlets, dtx, client.getHierarchy()) - - const props = getDTxProps(dtx) - let model: AttributeModel[] = [] - let modelIcon: Asset | undefined - let iconComponent: AnyComponent | undefined - - if (viewlet === undefined) { - ;({ viewlet, model } = await checkInlineViewlets(dtx, viewlet, client, model, dtx.isOwnTx)) - if (model !== undefined) { - // Check for State attribute - for (const a of model) { - if (a.icon !== undefined) { - modelIcon = a.icon - break - } - } - for (const a of model) { - if (a.attribute?.iconComponent !== undefined) { - iconComponent = a.attribute?.iconComponent - break - } - } - } - } - return { viewlet, id: dtx.tx._id, model, props, modelIcon, iconComponent } -} - -async function checkInlineViewlets ( - dtx: DisplayTx, - viewlet: TxDisplayViewlet, - client: TxOperations, - model: AttributeModel[], - isOwn: boolean -): Promise<{ viewlet: TxDisplayViewlet, model: AttributeModel[] }> { - if (dtx.collectionAttribute !== undefined && (dtx.txDocIds?.size ?? 0) > 1) { - // Check if we have a class presenter we could have a pseudo viewlet based on class presenter. - viewlet = await createPseudoViewlet(client, dtx, activity.string.CollectionUpdated, 'inline') - } else if (dtx.tx._class === core.class.TxCreateDoc) { - // Check if we have a class presenter we could have a pseudo viewlet based on class presenter. - viewlet = await createPseudoViewlet(client, dtx, isOwn ? activity.string.DocCreated : activity.string.DocAdded) - } else if (dtx.tx._class === core.class.TxRemoveDoc) { - viewlet = await createPseudoViewlet(client, dtx, activity.string.DocDeleted) - } else if (dtx.tx._class === core.class.TxUpdateDoc || dtx.tx._class === core.class.TxMixin) { - model = await createUpdateModel(dtx, client, model) - } - return { viewlet, model } -} - -async function getAttributePresenter ( - client: Client, - _class: Ref>, - key: string, - preserveKey: BuildModelKey -): Promise { - const hierarchy = client.getHierarchy() - const attribute = hierarchy.getAttribute(_class, key) - const presenterClass = getAttributePresenterClass(hierarchy, attribute) - const isCollectionAttr = presenterClass.category === 'collection' - const mixin = isCollectionAttr ? view.mixin.CollectionPresenter : view.mixin.ActivityAttributePresenter - let presenterMixin = hierarchy.classHierarchyMixin(presenterClass.attrClass, mixin) - if (presenterMixin?.presenter === undefined && mixin === view.mixin.ActivityAttributePresenter) { - presenterMixin = hierarchy.classHierarchyMixin(presenterClass.attrClass, view.mixin.AttributePresenter) - if (presenterMixin?.presenter === undefined) { - throw new Error('attribute presenter not found for ' + JSON.stringify(preserveKey)) - } - } else if (presenterMixin?.presenter === undefined) { - throw new Error('attribute presenter not found for ' + JSON.stringify(preserveKey)) - } - const resultKey = preserveKey.sortingKey ?? preserveKey.key - const sortingKey = Array.isArray(resultKey) - ? resultKey - : attribute.type._class === core.class.ArrOf - ? resultKey + '.length' - : resultKey - const presenter = await getResource(presenterMixin.presenter) - - return { - key: preserveKey.key, - sortingKey, - _class: presenterClass.attrClass, - label: preserveKey.label ?? attribute.shortLabel ?? attribute.label, - presenter, - props: preserveKey.props, - icon: presenterMixin.icon, - attribute, - collectionAttr: isCollectionAttr, - isLookup: false - } -} - -async function buildModel (options: BuildModelOptions): Promise { - // eslint-disable-next-line array-callback-return - const model = options.keys - .map((key) => (typeof key === 'string' ? { key } : key)) - .map(async (key) => { - try { - return await getAttributePresenter(options.client, options._class, key.key, key) - } catch (err: any) { - if (options.ignoreMissing ?? false) { - return undefined - } - const stringKey = key.label ?? key.key - console.error('Failed to find presenter for', key, err) - const errorPresenter: AttributeModel = { - key: '', - sortingKey: '', - presenter: ErrorPresenter, - label: stringKey as IntlString, - _class: core.class.TypeString, - props: { error: err }, - collectionAttr: false, - isLookup: false - } - return errorPresenter - } - }) - return (await Promise.all(model)).filter((a) => a !== undefined) as AttributeModel[] -} - -async function createUpdateModel ( - dtx: DisplayTx, - client: TxOperations, - model: AttributeModel[] -): Promise { - if (dtx.updateTx !== undefined) { - const _class = dtx.updateTx.objectClass - const ops = { - client, - _class, - keys: Object.entries(dtx.updateTx.operations) - .flatMap(([id, val]) => (['$push', '$pull'].includes(id) ? Object.keys(val) : id)) - .filter((id) => !id.startsWith('$')), - ignoreMissing: true - } - const hiddenAttrs = getHiddenAttrs(client, _class) - model = (await buildModel(ops)).filter((x) => !hiddenAttrs.has(x.key)) - } else if (dtx.mixinTx !== undefined) { - const _class = dtx.mixinTx.mixin - const ops = { - client, - _class, - keys: Object.keys(dtx.mixinTx.attributes).filter((id) => !id.startsWith('$')), - ignoreMissing: true - } - const hiddenAttrs = getHiddenAttrs(client, _class) - model = (await buildModel(ops)).filter((x) => !hiddenAttrs.has(x.key)) - } - return model -} - -function getHiddenAttrs (client: TxOperations, _class: Ref>): Set { - return new Set( - [...client.getHierarchy().getAllAttributes(_class).entries()] - .filter(([, attr]) => attr.hidden === true) - .map(([k]) => k) - ) -} - -function getModifiedAttributes (tx: DisplayTx): any[] { - if (tx.tx._class === core.class.TxUpdateDoc) { - return ([tx.tx, ...tx.txes.map(({ tx }) => tx)] as unknown as Array>).map( - ({ operations }) => operations - ) - } - if (tx.tx._class === core.class.TxMixin) { - return ([tx.tx, ...tx.txes.map(({ tx }) => tx)] as unknown as Array>).map( - ({ attributes }) => attributes - ) - } - return [{}] -} - -async function buildRemovedDoc ( - client: TxOperations, - objectId: Ref, - _class: Ref> -): Promise { - const isAttached = client.getHierarchy().isDerived(_class, core.class.AttachedDoc) - const txes = await client.findAll>( - isAttached ? core.class.TxCollectionCUD : core.class.TxCUD, - isAttached - ? { 'tx.objectId': objectId as Ref } - : { - objectId - }, - { sort: { modifiedOn: 1 } } - ) - const createTx = isAttached - ? txes.find((tx) => (tx as TxCollectionCUD).tx._class === core.class.TxCreateDoc) - : txes.find((tx) => tx._class === core.class.TxCreateDoc) - if (createTx === undefined) return - let doc = TxProcessor.createDoc2Doc(createTx as TxCreateDoc) - for (let tx of txes) { - tx = TxProcessor.extractTx(tx) as TxCUD - if (tx._class === core.class.TxUpdateDoc) { - doc = TxProcessor.updateDoc2Doc(doc, tx as TxUpdateDoc) - } else if (tx._class === core.class.TxMixin) { - const mixinTx = tx as TxMixin - doc = TxProcessor.updateMixin4Doc(doc, mixinTx) - } - } - return doc -} - -async function getAllRealValues ( - client: TxOperations, - values: any[], - _class: Ref> -): Promise<[any[], boolean]> { - if (values.length === 0) return [[], false] - if (values.some((value) => typeof value !== 'string')) { - return [values, false] - } - - if (valueTypes.includes(_class)) { - return [values, false] - } - - const realValues = await client.findAll(_class, { _id: { $in: values } }) - const realValuesIds = realValues.map(({ _id }) => _id) - const res = [ - ...realValues, - ...(await Promise.all( - values - .filter((value) => !realValuesIds.includes(value)) - .map(async (value) => await buildRemovedDoc(client, value, _class)) - )) - ].filter((v) => v != null) - return [res, true] -} - -function combineAttributes (attributes: any[], key: string, operator: string, arrayKey: string): any[] { - return Array.from( - new Set( - attributes.flatMap((attr) => - Array.isArray(attr[operator]?.[key]?.[arrayKey]) ? attr[operator]?.[key]?.[arrayKey] : attr[operator]?.[key] - ) - ) - ).filter((v) => v != null) -} - -interface TxAttributeValue { - set: any - isObjectSet: boolean - added: any[] - isObjectAdded: boolean - removed: any[] - isObjectRemoved: boolean -} - -export async function getValue (client: TxOperations, m: AttributeModel, tx: DisplayTx): Promise { - const utxs = getModifiedAttributes(tx) - const added = await getAllRealValues(client, combineAttributes(utxs, m.key, '$push', '$each'), m._class) - const removed = await getAllRealValues(client, combineAttributes(utxs, m.key, '$pull', '$in'), m._class) - const value: TxAttributeValue = { - set: utxs[0][m.key], - isObjectSet: false, - added: added[0], - isObjectAdded: added[1], - removed: removed[0], - isObjectRemoved: removed[1] - } - if (value.set !== undefined) { - const res = await getAllRealValues(client, [value.set], m._class) - value.set = res[0][0] - value.isObjectSet = res[1] - } - return value -} - export async function updateDocReactions ( client: TxOperations, reactions: Reaction[], diff --git a/plugins/activity/src/index.ts b/plugins/activity/src/index.ts index 00b4bc2a70..965fc4ec07 100644 --- a/plugins/activity/src/index.ts +++ b/plugins/activity/src/index.ts @@ -17,9 +17,7 @@ import { Person } from '@hcengineering/contact' import { Account, AttachedDoc, - Attribute, Class, - Collection, Doc, DocumentQuery, Mixin, @@ -27,83 +25,13 @@ import { type RelatedDocument, Timestamp, Tx, - TxCreateDoc, - TxCUD, - TxMixin, - TxUpdateDoc + TxCUD } from '@hcengineering/core' import type { Asset, IntlString, Plugin, Resource } from '@hcengineering/platform' import { plugin } from '@hcengineering/platform' import { Preference } from '@hcengineering/preference' import type { AnyComponent } from '@hcengineering/ui' -// TODO: remove TxViewlet -/** - * Define an display for all transaction kinds for particular class. - * @public - */ -export interface TxViewlet extends Doc { - icon: Asset - objectClass: Ref> - txClass: Ref> - // Component to display on. - component?: AnyComponent - - // If defined, will be added to label displayed - labelComponent?: AnyComponent - - // Filter - match?: DocumentQuery - - // Label will be displayed right after author - label?: IntlString - labelParams?: any - // Do component need to be emphasized or not. - display: 'inline' | 'content' | 'emphasized' - - // If defined and true, will show context menu with Edit action, and will pass 'edit:true' to viewlet properties. - editable?: boolean - - // If defined and true, will hide all transactions from object in case it is deleted. - hideOnRemove?: boolean -} - -// TODO: remove DisplayTx -/** - * Transaction being displayed. - * @public - */ -export interface DisplayTx { - // Source tx - tx: TxCUD - - // A set of collapsed transactions. - txes: DisplayTx[] - txDocIds?: Set> - - // type check for createTx - createTx?: TxCreateDoc - - // Type check for updateTx - updateTx?: TxUpdateDoc - - // Type check for updateTx - mixinTx?: TxMixin - - // Document in case it is required. - doc?: Doc - // Previous document in case it is required. - prevDoc?: Doc - - updated: boolean - mixin: boolean - removed: boolean - isOwnTx: boolean - - collectionAttribute?: Attribute> - originTx: TxCUD -} - /** * @public */ @@ -323,7 +251,6 @@ export default plugin(activityId, { IgnoreActivity: '' as Ref> }, class: { - TxViewlet: '' as Ref>, DocUpdateMessage: '' as Ref>, ActivityMessage: '' as Ref>, ActivityInfoMessage: '' as Ref>, diff --git a/plugins/attachment-resources/src/components/activity/TxAttachmentCreate.svelte b/plugins/attachment-resources/src/components/activity/TxAttachmentCreate.svelte deleted file mode 100644 index cec032b4d9..0000000000 --- a/plugins/attachment-resources/src/components/activity/TxAttachmentCreate.svelte +++ /dev/null @@ -1,31 +0,0 @@ - - - -{#if tx._class === core.class.TxRemoveDoc} - -{:else} - -{/if} diff --git a/plugins/attachment-resources/src/index.ts b/plugins/attachment-resources/src/index.ts index 1885d82a9e..ea948a75c4 100644 --- a/plugins/attachment-resources/src/index.ts +++ b/plugins/attachment-resources/src/index.ts @@ -20,7 +20,6 @@ import preference from '@hcengineering/preference' import { PDFViewer, deleteFile, getClient, uploadFile } from '@hcengineering/presentation' import activity, { type ActivityMessage, type DocUpdateMessage } from '@hcengineering/activity' -import TxAttachmentCreate from './components/activity/TxAttachmentCreate.svelte' import AddAttachment from './components/AddAttachment.svelte' import AttachmentDocList from './components/AttachmentDocList.svelte' import AttachmentDroppable from './components/AttachmentDroppable.svelte' @@ -261,7 +260,6 @@ export default async (): Promise => ({ PDFViewer }, activity: { - TxAttachmentCreate, AttachmentsUpdatedMessage }, helper: { diff --git a/plugins/calendar-resources/src/components/activity/ReminderViewlet.svelte b/plugins/calendar-resources/src/components/activity/ReminderViewlet.svelte deleted file mode 100644 index 84e32b943a..0000000000 --- a/plugins/calendar-resources/src/components/activity/ReminderViewlet.svelte +++ /dev/null @@ -1,52 +0,0 @@ - - - -
- {#await getEvent(tx.objectId) then event} - {#if event} - - - { - click(event) - }} - >{event.title} - -   - - {/if} - {/await} -
diff --git a/plugins/calendar-resources/src/index.ts b/plugins/calendar-resources/src/index.ts index b9c3377965..ae446fad61 100644 --- a/plugins/calendar-resources/src/index.ts +++ b/plugins/calendar-resources/src/index.ts @@ -29,7 +29,6 @@ import IntegrationConnect from './components/IntegrationConnect.svelte' import PersonsPresenter from './components/PersonsPresenter.svelte' import SaveEventReminder from './components/SaveEventReminder.svelte' import UpdateRecInstancePopup from './components/UpdateRecInstancePopup.svelte' -import ReminderViewlet from './components/activity/ReminderViewlet.svelte' import CalendarIntegrationIcon from './components/icons/Calendar.svelte' import EventElement from './components/EventElement.svelte' import CalendarEventPresenter from './components/CalendarEventPresenter.svelte' @@ -192,9 +191,6 @@ export default async (): Promise => ({ IntegrationConfigure, ConnectApp }, - activity: { - ReminderViewlet - }, actionImpl: { SaveEventReminder: saveEventReminder, DeleteRecEvent: deleteRecEvent diff --git a/plugins/calendar-resources/src/plugin.ts b/plugins/calendar-resources/src/plugin.ts index a8f8336a4b..771952852c 100644 --- a/plugins/calendar-resources/src/plugin.ts +++ b/plugins/calendar-resources/src/plugin.ts @@ -15,12 +15,8 @@ import calendar, { calendarId } from '@hcengineering/calendar' import { type IntlString, mergeIds } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' export default mergeIds(calendarId, calendar, { - activity: { - ReminderViewlet: '' as AnyComponent - }, string: { Events: '' as IntlString, RemindMeAt: '' as IntlString, diff --git a/plugins/chunter-resources/src/components/DirectMessageInput.svelte b/plugins/chunter-resources/src/components/DirectMessageInput.svelte deleted file mode 100644 index f6e5653a59..0000000000 --- a/plugins/chunter-resources/src/components/DirectMessageInput.svelte +++ /dev/null @@ -1,63 +0,0 @@ - - -{#if space !== undefined} -
- -
-{/if} - - diff --git a/plugins/chunter-resources/src/components/DirectMessagePresenter.svelte b/plugins/chunter-resources/src/components/DirectMessagePresenter.svelte deleted file mode 100644 index 0bf3face9f..0000000000 --- a/plugins/chunter-resources/src/components/DirectMessagePresenter.svelte +++ /dev/null @@ -1,25 +0,0 @@ - - -{#if dm} - {#await getDmName(client, dm) then name} - - {name} - -
- {/await} -{/if} diff --git a/plugins/chunter-resources/src/index.ts b/plugins/chunter-resources/src/index.ts index 7e2879a89b..9e7bb6719e 100644 --- a/plugins/chunter-resources/src/index.ts +++ b/plugins/chunter-resources/src/index.ts @@ -26,10 +26,8 @@ import ChunterBrowser from './components/chat/specials/ChunterBrowser.svelte' import ConvertDmToPrivateChannelModal from './components/ConvertDmToPrivateChannel.svelte' import CreateChannel from './components/chat/create/CreateChannel.svelte' import CreateDirectChat from './components/chat/create/CreateDirectChat.svelte' -import DirectMessagePresenter from './components/DirectMessagePresenter.svelte' import DmHeader from './components/DmHeader.svelte' import DmPresenter from './components/DmPresenter.svelte' -import DirectMessageInput from './components/DirectMessageInput.svelte' import EditChannel from './components/EditChannel.svelte' import ChannelPreview from './components/ChannelPreview.svelte' import ThreadView from './components/threads/ThreadView.svelte' @@ -160,12 +158,10 @@ export default async (): Promise => ({ ChannelHeader, ChannelPanel, ChannelPresenter, - DirectMessagePresenter, ChannelPreview, ChunterBrowser, DmHeader, DmPresenter, - DirectMessageInput, EditChannel, ThreadView, SavedMessages, diff --git a/plugins/chunter-resources/src/plugin.ts b/plugins/chunter-resources/src/plugin.ts index 6a059ad5e7..fa29fa6458 100644 --- a/plugins/chunter-resources/src/plugin.ts +++ b/plugins/chunter-resources/src/plugin.ts @@ -32,7 +32,6 @@ export default mergeIds(chunterId, chunter, { EditChannel: '' as AnyComponent, ChannelPreview: '' as AnyComponent, MessagePreview: '' as AnyComponent, - DirectMessageInput: '' as AnyComponent, CreateDocChannel: '' as AnyComponent, SavedMessages: '' as AnyComponent, Threads: '' as AnyComponent, diff --git a/plugins/chunter/src/index.ts b/plugins/chunter/src/index.ts index 469b51029a..eddb9fb580 100644 --- a/plugins/chunter/src/index.ts +++ b/plugins/chunter/src/index.ts @@ -14,8 +14,7 @@ // import { ActivityMessage, ActivityMessageViewlet } from '@hcengineering/activity' -import type { Person } from '@hcengineering/contact' -import type { Account, AttachedDoc, Class, Doc, Markup, Mixin, Ref, Space, Timestamp } from '@hcengineering/core' +import type { Class, Doc, Markup, Mixin, Ref, Space, Timestamp } from '@hcengineering/core' import { NotificationType } from '@hcengineering/notification' import type { Asset, Plugin } from '@hcengineering/platform' import { IntlString, plugin } from '@hcengineering/platform' @@ -25,9 +24,7 @@ import { Action } from '@hcengineering/view' /** * @public */ -export interface ChunterSpace extends Space { - lastMessage?: Timestamp -} +export interface ChunterSpace extends Space {} /** * @public @@ -41,42 +38,6 @@ export interface Channel extends ChunterSpace { */ export interface DirectMessage extends ChunterSpace {} -/** - * @public - * @deprecated use ChatMessage instead - */ -export interface ChunterMessage extends AttachedDoc { - content: Markup - attachments?: number - createBy: Ref - editedOn?: Timestamp - reactions?: number -} - -/** - * @public - */ -export interface ChunterMessageExtension extends ChunterMessage {} - -/** - * @public - * @deprecated use ChatMessage instead - */ -export interface Message extends ChunterMessage { - attachedTo: Ref - attachedToClass: Ref> - replies?: Ref[] - repliesCount?: number - lastReply?: Timestamp -} - -/** - * @public - */ -export interface DirectMessageInput extends Class { - component: AnyComponent -} - /** * @public */ @@ -141,8 +102,6 @@ export default plugin(chunterId, { ThreadMessagePreview: '' as AnyComponent }, class: { - Message: '' as Ref>, - ChunterMessage: '' as Ref>, ThreadMessage: '' as Ref>, ChunterSpace: '' as Ref>, Channel: '' as Ref>, @@ -151,8 +110,6 @@ export default plugin(chunterId, { ChatMessageViewlet: '' as Ref> }, mixin: { - DirectMessageInput: '' as Ref>, - ChunterMessageExtension: '' as Ref>, ObjectChatPanel: '' as Ref> }, string: { diff --git a/plugins/contact-resources/src/components/activity/TxNameChange.svelte b/plugins/contact-resources/src/components/activity/TxNameChange.svelte deleted file mode 100644 index 6a1fe79aea..0000000000 --- a/plugins/contact-resources/src/components/activity/TxNameChange.svelte +++ /dev/null @@ -1,34 +0,0 @@ - - - -{#if val} - - - - - {formatName(val)} - -{/if} diff --git a/plugins/contact-resources/src/index.ts b/plugins/contact-resources/src/index.ts index e4e97bc22f..4c1e06161b 100644 --- a/plugins/contact-resources/src/index.ts +++ b/plugins/contact-resources/src/index.ts @@ -117,7 +117,6 @@ import UsersList from './components/UsersList.svelte' import UsersPopup from './components/UsersPopup.svelte' import ActivityChannelPresenter from './components/activity/ActivityChannelPresenter.svelte' import NameChangedActivityMessage from './components/activity/NameChangedActivityMessage.svelte' -import TxNameChange from './components/activity/TxNameChange.svelte' import IconAddMember from './components/icons/AddMember.svelte' import ExpandRightDouble from './components/icons/ExpandRightDouble.svelte' import IconMembers from './components/icons/Members.svelte' @@ -320,7 +319,6 @@ export default async (): Promise => ({ OpenChannel: openChannelURL }, activity: { - TxNameChange, NameChangedActivityMessage }, component: { diff --git a/plugins/controlled-documents-resources/src/components/activity/TxCreateApprovalRequest.svelte b/plugins/controlled-documents-resources/src/components/activity/TxCreateApprovalRequest.svelte deleted file mode 100644 index 507dbed9bd..0000000000 --- a/plugins/controlled-documents-resources/src/components/activity/TxCreateApprovalRequest.svelte +++ /dev/null @@ -1,40 +0,0 @@ - - - -{#if controlledDoc} - - -{/if} diff --git a/plugins/controlled-documents-resources/src/components/activity/TxCreateReviewRequest.svelte b/plugins/controlled-documents-resources/src/components/activity/TxCreateReviewRequest.svelte deleted file mode 100644 index ee4a83d86e..0000000000 --- a/plugins/controlled-documents-resources/src/components/activity/TxCreateReviewRequest.svelte +++ /dev/null @@ -1,40 +0,0 @@ - - - -{#if controlledDoc} - - -{/if} diff --git a/plugins/controlled-documents-resources/src/index.ts b/plugins/controlled-documents-resources/src/index.ts index 6f7e332600..6487dbacf0 100644 --- a/plugins/controlled-documents-resources/src/index.ts +++ b/plugins/controlled-documents-resources/src/index.ts @@ -80,10 +80,8 @@ import DocumentVersionPresenter from './components/document/presenters/DocumentV import DocumentSectionDeletePopup from './components/DocumentSectionDeletePopup.svelte' -import TxCreateReviewRequest from './components/activity/TxCreateReviewRequest.svelte' import DocumentReviewRequest from './components/requests/DocumentReviewRequest.svelte' import DocumentReviewRequestPresenter from './components/requests/DocumentReviewRequestPresenter.svelte' -import TxCreateApprovalRequest from './components/activity/TxCreateApprovalRequest.svelte' import DocumentApprovalRequest from './components/requests/DocumentApprovalRequest.svelte' import DocumentApprovalRequestPresenter from './components/requests/DocumentApprovalRequestPresenter.svelte' import ControlledStateFilterValuePresenter from './components/document/presenters/ControlledStateFilterValuePresenter.svelte' @@ -331,10 +329,8 @@ export default async (): Promise => ({ DocumentSectionDeletePopup, CollaborativeSectionPresenter, AttachmentsSectionPresenter, - TxCreateReviewRequest, DocumentReviewRequest, DocumentReviewRequestPresenter, - TxCreateApprovalRequest, DocumentApprovalRequest, DocumentApprovalRequestPresenter, StateFilterValuePresenter, diff --git a/plugins/controlled-documents-resources/src/plugin.ts b/plugins/controlled-documents-resources/src/plugin.ts index aeab6d302b..553ed17989 100644 --- a/plugins/controlled-documents-resources/src/plugin.ts +++ b/plugins/controlled-documents-resources/src/plugin.ts @@ -42,11 +42,9 @@ export default mergeIds(documentsId, documents, { DocumentReviewRequest: '' as AnyComponent, DocumentReviewRequestPresenter: '' as AnyComponent, - TxCreateReviewRequest: '' as AnyComponent, DocumentApprovalRequest: '' as AnyComponent, DocumentApprovalRequestPresenter: '' as AnyComponent, - TxCreateApprovalRequest: '' as AnyComponent, CreateDocumentsSpace: '' as AnyComponent }, diff --git a/plugins/controlled-documents/src/plugin.ts b/plugins/controlled-documents/src/plugin.ts index b9e8d5c1be..10ff524de9 100644 --- a/plugins/controlled-documents/src/plugin.ts +++ b/plugins/controlled-documents/src/plugin.ts @@ -1,4 +1,3 @@ -import { TxViewlet } from '@hcengineering/activity' import { type Class, type Doc, @@ -282,8 +281,6 @@ export const documentsPlugin = plugin(documentsId, { ConfigDescription: '' as IntlString }, ids: { - TxReviewRequestCreated: '' as Ref, - TxApprovalRequestCreated: '' as Ref, NoParent: '' as Ref, NoProject: '' as Ref }, diff --git a/plugins/gmail-resources/src/components/activity/TxSharedCreate.svelte b/plugins/gmail-resources/src/components/activity/TxSharedCreate.svelte deleted file mode 100644 index 0e3eb5acec..0000000000 --- a/plugins/gmail-resources/src/components/activity/TxSharedCreate.svelte +++ /dev/null @@ -1,25 +0,0 @@ - - - - diff --git a/plugins/gmail-resources/src/components/activity/TxWriteMessage.svelte b/plugins/gmail-resources/src/components/activity/TxWriteMessage.svelte deleted file mode 100644 index 4c6bdb51ff..0000000000 --- a/plugins/gmail-resources/src/components/activity/TxWriteMessage.svelte +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -{value.subject} diff --git a/plugins/gmail-resources/src/index.ts b/plugins/gmail-resources/src/index.ts index d3f5397443..2b1ae6b305 100644 --- a/plugins/gmail-resources/src/index.ts +++ b/plugins/gmail-resources/src/index.ts @@ -17,8 +17,6 @@ import { concatLink } from '@hcengineering/core' import { getMetadata, type Resources } from '@hcengineering/platform' import presentation from '@hcengineering/presentation' -import TxSharedCreate from './components/activity/TxSharedCreate.svelte' -import TxWriteMessage from './components/activity/TxWriteMessage.svelte' import GmailWriteMessage from './components/activity/GmailWriteMessage.svelte' import GmailSharedMessage from './components/activity/GmailSharedMessage.svelte' import Configure from './components/Configure.svelte' @@ -38,8 +36,6 @@ export default async (): Promise => ({ Configure }, activity: { - TxSharedCreate, - TxWriteMessage, GmailWriteMessage, GmailSharedMessage }, diff --git a/plugins/notification-resources/src/components/EmployeeInbox.svelte b/plugins/notification-resources/src/components/EmployeeInbox.svelte deleted file mode 100644 index 7b80940573..0000000000 --- a/plugins/notification-resources/src/components/EmployeeInbox.svelte +++ /dev/null @@ -1,249 +0,0 @@ - - - - -
-
- {#if employee} - - {getName(client.getHierarchy(), employee)} - {/if} - {#if newTxes > 0} - - {newTxes} - - {/if} -
- {#if me !== accountId} -
-
- - {#if loading} - - {:else} - {#each filteredDocs as item, i (item._id)} -
- { - selected = i - changeSelected(selected) - }} - preview - /> -
- {/each} - {/if} -
-
-{#if dmInput && account} - -{/if} - - diff --git a/plugins/notification-resources/src/components/People.svelte b/plugins/notification-resources/src/components/People.svelte deleted file mode 100644 index f78ca28ea1..0000000000 --- a/plugins/notification-resources/src/components/People.svelte +++ /dev/null @@ -1,187 +0,0 @@ - - - -
- - {#if loading} - - {:else} - {#each accounts as account, i} - - { - selected = i - }} - /> - {/each} - {/if} - -
diff --git a/plugins/notification-resources/src/components/PeopleNotificationsView.svelte b/plugins/notification-resources/src/components/PeopleNotificationsView.svelte deleted file mode 100644 index 96325832a7..0000000000 --- a/plugins/notification-resources/src/components/PeopleNotificationsView.svelte +++ /dev/null @@ -1,128 +0,0 @@ - - - -{#if doc} - -
dispatch('open', value._id)} - > - {#if newTxes > 0 && !selected}
{/if} - -
-
- - {#if employee} - {getName(client.getHierarchy(), employee)} - {:else} - - {/if} - {#if newTxes > 0} -
- {newTxes} -
- {/if} -
- { - dispatch('open', value._id) - }} - /> -
-
-
- {#if presenter} - - {/if} -
-
- {#if tx && firstItem} - - {/if} -
- -
-
-
-
-{/if} diff --git a/plugins/notification-resources/src/components/activity/TxCollaboratorsChange.svelte b/plugins/notification-resources/src/components/activity/TxCollaboratorsChange.svelte deleted file mode 100644 index 3e9c1accd5..0000000000 --- a/plugins/notification-resources/src/components/activity/TxCollaboratorsChange.svelte +++ /dev/null @@ -1,81 +0,0 @@ - - - -{#if diff} -