From 2bf1a039071da3b9e5ee5f3588b50ebbdedd1a66 Mon Sep 17 00:00:00 2001 From: Kristina Date: Wed, 13 Dec 2023 19:59:11 +0400 Subject: [PATCH] UBERF-4632: refactor activity classes structure (#4190) Signed-off-by: Kristina Fefelova --- common/config/rush/pnpm-lock.yaml | 152 ++++++++-- dev/generator/package.json | 2 +- dev/generator/src/comments.ts | 14 +- dev/prod/package.json | 4 +- dev/tool/package.json | 4 +- dev/tool/src/__start.ts | 2 + dev/tool/src/clean.ts | 10 +- dev/tool/src/mixin.ts | 2 - models/activity/package.json | 3 +- models/activity/src/index.ts | 191 +++++++++++- models/activity/src/migration.ts | 48 ++++ models/activity/src/plugin.ts | 22 +- models/all/package.json | 1 + models/all/src/index.ts | 3 +- models/all/src/migration.ts | 6 +- models/attachment/package.json | 1 - models/attachment/src/index.ts | 15 +- models/attachment/src/plugin.ts | 13 +- models/calendar/src/index.ts | 4 +- models/calendar/src/plugin.ts | 6 +- models/chunter/package.json | 1 + models/chunter/src/index.ts | 179 ++++++------ models/chunter/src/migration.ts | 5 +- models/chunter/src/plugin.ts | 30 +- models/contact/package.json | 31 +- models/contact/src/index.ts | 53 ++-- models/contact/src/plugin.ts | 9 +- models/hr/package.json | 23 +- models/hr/src/index.ts | 5 +- models/inventory/package.json | 23 +- models/inventory/src/index.ts | 27 +- models/inventory/src/plugin.ts | 2 +- models/lead/package.json | 34 +-- models/lead/src/index.ts | 24 +- models/lead/src/plugin.ts | 3 +- models/notification/src/activityMessages.ts | 148 ---------- models/notification/src/index.ts | 227 +++++---------- models/notification/src/plugin.ts | 26 +- models/recruit/package.json | 2 + models/recruit/src/index.ts | 38 ++- models/recruit/src/plugin.ts | 11 +- models/recruit/src/review-model.ts | 5 +- models/request/src/index.ts | 6 +- models/server-activity/.eslintrc.js | 7 + models/server-activity/.npmignore | 4 + models/server-activity/config/rig.json | 5 + models/server-activity/package.json | 36 +++ models/server-activity/src/index.ts | 38 +++ .../src/migration.ts | 47 +-- models/server-activity/tsconfig.json | 9 + models/server-chunter/src/index.ts | 2 +- models/server-notification/package.json | 5 +- models/server-notification/src/index.ts | 14 +- models/server-openai/package.json | 2 +- models/server-openai/src/index.ts | 4 +- models/setting/src/index.ts | 4 +- models/setting/src/plugin.ts | 10 +- models/task/package.json | 2 +- models/task/src/index.ts | 5 +- models/task/src/plugin.ts | 1 - models/telegram/src/index.ts | 8 +- models/telegram/src/plugin.ts | 8 +- models/tracker/package.json | 1 + models/tracker/src/index.ts | 71 +++-- models/tracker/src/plugin.ts | 20 +- models/tracker/src/types.ts | 8 +- models/view/src/index.ts | 13 +- packages/platform/package.json | 24 +- plugins/activity-assets/assets/icons.svg | 5 + plugins/activity-assets/lang/en.json | 20 +- plugins/activity-assets/lang/ru.json | 26 +- plugins/activity-assets/src/index.ts | 3 +- plugins/activity-resources/package.json | 3 +- .../src/activityMessagesUtils.ts | 94 ++---- .../src/components/Activity.svelte | 24 +- .../src/components/ActivityExtension.svelte} | 18 +- .../src/components/ActivityFilter.svelte | 9 +- .../src/components/FilterPopup.svelte | 4 +- .../ActivityMessageExtension.svelte | 2 +- .../ActivityMessagePresenter.svelte | 4 +- .../ActivityMessageTemplate.svelte | 38 +-- .../activity-message/PinMessageAction.svelte | 2 +- .../DocUpdateMessageAttributes.svelte | 7 +- .../DocUpdateMessageContent.svelte | 15 +- .../DocUpdateMessageHeader.svelte | 14 +- .../DocUpdateMessageObjectValue.svelte | 6 +- .../DocUpdateMessagePresenter.svelte | 34 ++- .../AddedAttributesPresenter.svelte | 4 +- .../ChangeAttributesTemplate.svelte | 4 +- .../RemovedAttributesPresenter.svelte | 4 +- .../attributes/SetAttributesPresenter.svelte | 10 +- .../reactions/AddReactionAction.svelte} | 9 +- .../reactions/ReactionAddedMessage.svelte} | 3 +- .../components/reactions}/Reactions.svelte | 4 +- .../reactions}/ReactionsPresenter.svelte | 8 +- .../reactions}/ReactionsTooltip.svelte | 0 plugins/activity-resources/src/index.ts | 21 +- plugins/activity-resources/src/utils.ts | 29 +- plugins/activity/package.json | 1 - plugins/activity/src/index.ts | 175 ++++++++++- plugins/attachment-resources/package.json | 1 - .../AttachmentsUpdatedMessage.svelte} | 2 +- plugins/attachment-resources/src/index.ts | 14 +- plugins/bitrix/package.json | 2 +- plugins/bitrix/src/sync.ts | 4 +- plugins/chunter-resources/package.json | 1 + .../src/components/Channel.svelte | 4 +- .../src/components/Message.svelte | 13 +- .../src/components/Thread.svelte | 4 +- .../src/components/ThreadView.svelte | 6 +- .../BacklinkCreatedLabel.svelte} | 7 +- .../chat-message/ChatMessageHeader.svelte | 6 +- .../chat-message/ChatMessageInput.svelte | 6 +- .../chat-message/ChatMessagePopup.svelte | 9 +- .../chat-message/ChatMessagePresenter.svelte | 26 +- .../chat-message/ChatMessagesPresenter.svelte | 0 plugins/chunter-resources/src/index.ts | 53 ++-- plugins/chunter-resources/src/plugin.ts | 3 +- plugins/chunter-resources/src/utils.ts | 29 +- plugins/chunter/package.json | 12 +- plugins/chunter/src/index.ts | 42 ++- plugins/contact-resources/package.json | 1 - .../NameChangedActivityMessage.svelte} | 8 +- plugins/contact-resources/src/index.ts | 8 +- plugins/notification-assets/assets/icons.svg | 20 -- plugins/notification-assets/lang/en.json | 26 +- plugins/notification-assets/lang/ru.json | 26 +- plugins/notification-assets/src/index.ts | 5 +- .../NotificationCollaboratorsChanged.svelte | 4 +- .../src/components/icons/Emoji.svelte | 24 -- .../src/components/icons/Thread.svelte | 27 -- .../src/components/inbox/Inbox.svelte | 19 +- .../src/components/inbox/InboxAside.svelte | 21 +- .../src/inboxNotificationsClient.ts | 4 +- plugins/notification-resources/src/index.ts | 48 +--- plugins/notification-resources/src/utils.ts | 109 +++++-- plugins/notification/package.json | 1 + plugins/notification/src/index.ts | 198 +------------ plugins/request/package.json | 2 +- plugins/request/src/index.ts | 2 +- plugins/task/package.json | 3 +- plugins/task/src/index.ts | 4 - .../src/components/issues/IssuePreview.svelte | 6 +- .../src/components/issues/KanbanView.svelte | 2 +- plugins/view/src/index.ts | 8 - pods/server/package.json | 2 + pods/server/src/server.ts | 2 + rush.json | 15 + .../activity-resources/.eslintrc.js | 7 + server-plugins/activity-resources/.npmignore | 4 + .../activity-resources/config/rig.json | 4 + .../activity-resources/jest.config.js | 7 + .../activity-resources/package.json | 38 +++ .../activity-resources/src/index.ts | 272 ++++++++++++++++++ .../activity-resources/src/utils.ts | 268 +++++++++++++++++ .../activity-resources/tsconfig.json | 9 + server-plugins/activity/.eslintrc.js | 7 + server-plugins/activity/.npmignore | 4 + server-plugins/activity/config/rig.json | 4 + server-plugins/activity/jest.config.js | 7 + server-plugins/activity/package.json | 38 +++ server-plugins/activity/src/index.ts | 34 +++ server-plugins/activity/src/types.ts | 13 + server-plugins/activity/src/utils.ts | 100 +++++++ server-plugins/activity/tsconfig.json | 9 + .../notification-resources/package.json | 1 + .../notification-resources/src/index.ts | 254 +--------------- .../notification-resources/src/types.ts | 9 - .../notification-resources/src/utils.ts | 271 ----------------- server-plugins/notification/src/index.ts | 87 +----- server-plugins/openai/package.json | 2 +- server-plugins/openai/src/resources.ts | 11 +- server-plugins/tracker-resources/package.json | 1 + server-plugins/tracker-resources/src/index.ts | 6 +- 174 files changed, 2535 insertions(+), 2134 deletions(-) create mode 100644 models/activity/src/migration.ts delete mode 100644 models/notification/src/activityMessages.ts create mode 100644 models/server-activity/.eslintrc.js create mode 100644 models/server-activity/.npmignore create mode 100644 models/server-activity/config/rig.json create mode 100644 models/server-activity/package.json create mode 100644 models/server-activity/src/index.ts rename models/{server-notification => server-activity}/src/migration.ts (83%) create mode 100644 models/server-activity/tsconfig.json rename plugins/{notification-resources => activity-resources}/src/activityMessagesUtils.ts (85%) rename plugins/{chunter-resources/src/components/notification/ActivityMessageReactionsAction.svelte => activity-resources/src/components/ActivityExtension.svelte} (57%) rename plugins/{notification-resources => activity-resources}/src/components/activity-message/ActivityMessageExtension.svelte (96%) rename plugins/{notification-resources => activity-resources}/src/components/activity-message/ActivityMessagePresenter.svelte (92%) rename plugins/{notification-resources => activity-resources}/src/components/activity-message/ActivityMessageTemplate.svelte (87%) rename plugins/{notification-resources => activity-resources}/src/components/activity-message/PinMessageAction.svelte (94%) rename plugins/{notification-resources => activity-resources}/src/components/doc-update-message/DocUpdateMessageAttributes.svelte (86%) rename plugins/{notification-resources => activity-resources}/src/components/doc-update-message/DocUpdateMessageContent.svelte (91%) rename plugins/{notification-resources => activity-resources}/src/components/doc-update-message/DocUpdateMessageHeader.svelte (89%) rename plugins/{notification-resources => activity-resources}/src/components/doc-update-message/DocUpdateMessageObjectValue.svelte (91%) rename plugins/{notification-resources => activity-resources}/src/components/doc-update-message/DocUpdateMessagePresenter.svelte (87%) rename plugins/{notification-resources => activity-resources}/src/components/doc-update-message/attributes/AddedAttributesPresenter.svelte (88%) rename plugins/{notification-resources => activity-resources}/src/components/doc-update-message/attributes/ChangeAttributesTemplate.svelte (94%) rename plugins/{notification-resources => activity-resources}/src/components/doc-update-message/attributes/RemovedAttributesPresenter.svelte (88%) rename plugins/{notification-resources => activity-resources}/src/components/doc-update-message/attributes/SetAttributesPresenter.svelte (90%) rename plugins/{chunter-resources/src/components/ReactionsAction.svelte => activity-resources/src/components/reactions/AddReactionAction.svelte} (86%) rename plugins/{chunter-resources/src/components/notification/NotificationReactionCreated.svelte => activity-resources/src/components/reactions/ReactionAddedMessage.svelte} (92%) rename plugins/{chunter-resources/src/components => activity-resources/src/components/reactions}/Reactions.svelte (96%) rename plugins/{chunter-resources/src/components => activity-resources/src/components/reactions}/ReactionsPresenter.svelte (84%) rename plugins/{chunter-resources/src/components => activity-resources/src/components/reactions}/ReactionsTooltip.svelte (100%) rename plugins/attachment-resources/src/components/{notification/NotificationAttachmentChanged.svelte => activity/AttachmentsUpdatedMessage.svelte} (94%) rename plugins/chunter-resources/src/components/{notification/NotificationBacklinkLabel.svelte => activity/BacklinkCreatedLabel.svelte} (98%) rename plugins/{notification-resources => chunter-resources}/src/components/chat-message/ChatMessageHeader.svelte (89%) rename plugins/{notification-resources => chunter-resources}/src/components/chat-message/ChatMessageInput.svelte (94%) rename plugins/{notification-resources => chunter-resources}/src/components/chat-message/ChatMessagePopup.svelte (92%) rename plugins/{notification-resources => chunter-resources}/src/components/chat-message/ChatMessagePresenter.svelte (84%) rename plugins/{notification-resources => chunter-resources}/src/components/chat-message/ChatMessagesPresenter.svelte (100%) rename plugins/contact-resources/src/components/{notification/NotificationNameChanged.svelte => activity/NameChangedActivityMessage.svelte} (85%) delete mode 100644 plugins/notification-resources/src/components/icons/Emoji.svelte delete mode 100644 plugins/notification-resources/src/components/icons/Thread.svelte create mode 100644 server-plugins/activity-resources/.eslintrc.js create mode 100644 server-plugins/activity-resources/.npmignore create mode 100644 server-plugins/activity-resources/config/rig.json create mode 100644 server-plugins/activity-resources/jest.config.js create mode 100644 server-plugins/activity-resources/package.json create mode 100644 server-plugins/activity-resources/src/index.ts create mode 100644 server-plugins/activity-resources/src/utils.ts create mode 100644 server-plugins/activity-resources/tsconfig.json create mode 100644 server-plugins/activity/.eslintrc.js create mode 100644 server-plugins/activity/.npmignore create mode 100644 server-plugins/activity/config/rig.json create mode 100644 server-plugins/activity/jest.config.js create mode 100644 server-plugins/activity/package.json create mode 100644 server-plugins/activity/src/index.ts create mode 100644 server-plugins/activity/src/types.ts create mode 100644 server-plugins/activity/src/utils.ts create mode 100644 server-plugins/activity/tsconfig.json diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 6bdeebf555..3941fbfd42 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -248,6 +248,9 @@ dependencies: '@rush-temp/model-request': specifier: file:./projects/model-request.tgz version: file:projects/model-request.tgz(svelte@4.2.5)(typescript@5.2.2) + '@rush-temp/model-server-activity': + specifier: file:./projects/model-server-activity.tgz + version: file:projects/model-server-activity.tgz(svelte@4.2.5)(typescript@5.2.2) '@rush-temp/model-server-attachment': specifier: file:./projects/model-server-attachment.tgz version: file:projects/model-server-attachment.tgz(svelte@4.2.5)(typescript@5.2.2) @@ -419,6 +422,12 @@ dependencies: '@rush-temp/server': specifier: file:./projects/server.tgz version: file:projects/server.tgz(esbuild@0.16.17)(svelte@4.2.5) + '@rush-temp/server-activity': + specifier: file:./projects/server-activity.tgz + version: file:projects/server-activity.tgz(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1) + '@rush-temp/server-activity-resources': + specifier: file:./projects/server-activity-resources.tgz + version: file:projects/server-activity-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1) '@rush-temp/server-attachment': specifier: file:./projects/server-attachment.tgz version: file:projects/server-attachment.tgz(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1) @@ -17385,7 +17394,7 @@ packages: dev: false file:projects/activity-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(ts-node@10.9.1): - resolution: {integrity: sha512-DVHj9i9C5lbJ32UBOF+g2PFNkto0xeOjjTO3q0lfOUw/pyRji3eDOomUlQowQF/Ssfj2ENj2zbVf0qfwkajqFg==, tarball: file:projects/activity-resources.tgz} + resolution: {integrity: sha512-F4DXewrthjnPi36RuMEgym+/VACMDSyCmP8QvXHUPvwu7x113/rtbhzOhSPSaj+jwZCzMiKTKXOU68B8Q1j+fw==, tarball: file:projects/activity-resources.tgz} id: file:projects/activity-resources.tgz name: '@rush-temp/activity-resources' version: 0.0.0 @@ -17431,7 +17440,7 @@ packages: dev: false file:projects/activity.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): - resolution: {integrity: sha512-h7I/WsfTBnPccjlbHUvZmZk8FQLucSPZ7kHmei9tY1rqKMX6MgDYnRN5sDQlrcKOJSwxoGRBK63OU1L2WBnzZg==, tarball: file:projects/activity.tgz} + resolution: {integrity: sha512-DwKYrRwF0ueeZMJ/FS/LEg+r/HhwqApV4K8cCmy0snR8ANFai7ySCs+4kswontH7boYtqqYXPc0Mh3GbJt9PKw==, tarball: file:projects/activity.tgz} id: file:projects/activity.tgz name: '@rush-temp/activity' version: 0.0.0 @@ -17529,7 +17538,7 @@ packages: dev: false file:projects/attachment-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(ts-node@10.9.1): - resolution: {integrity: sha512-QPfn6dtMu8QvYwO0UoayUlCuk6qMfyOo836hndO4KKPvt71Q+1uTw5c2Q4vMNckG50tOH65S/gmTuPuNm9DQug==, tarball: file:projects/attachment-resources.tgz} + resolution: {integrity: sha512-+Zr0eBeCAPnbhW+YAVY53/OQ0IY+ORNdIJXxWONDojcEvg7ANDm7EL/P/fyXMC6zst21/rJK/Wr+QDSK0zxQXA==, tarball: file:projects/attachment-resources.tgz} id: file:projects/attachment-resources.tgz name: '@rush-temp/attachment-resources' version: 0.0.0 @@ -17690,7 +17699,7 @@ packages: dev: false file:projects/bitrix.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): - resolution: {integrity: sha512-KSTAiioVIT5On4ssg74B1eLoBrcbAMC7iO6LIoIIvVZu9bftEF+3jJ443j4x9mdgUPABKo/c31bRwLNxl+K+Lw==, tarball: file:projects/bitrix.tgz} + resolution: {integrity: sha512-b6hu02DfbmNCgR4rJ3btQJeOMKvH5Ce/+ctqexUT48rqdVQCcETVqLM7OU1oUKekwU5wRpiW5lhwXKeYqwh5Sw==, tarball: file:projects/bitrix.tgz} id: file:projects/bitrix.tgz name: '@rush-temp/bitrix' version: 0.0.0 @@ -17979,7 +17988,7 @@ packages: dev: false file:projects/chunter-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(ts-node@10.9.1): - resolution: {integrity: sha512-gjwoANHcUvGbxTXLdl0tFOzdiSsOMVy7Jm2zzArXY9+EVyrURwq2qEjgnA36KnkWHd7mUEpEUJBd8MWndKCJgA==, tarball: file:projects/chunter-resources.tgz} + resolution: {integrity: sha512-IW9B1wnQQ6r603qhRGUI498gj5Cn4qsdnRmbd/z6F+6nYCCw2vfYDY1SihlRZBfs31U8f6qgJNov5rGhjhv5ZQ==, tarball: file:projects/chunter-resources.tgz} id: file:projects/chunter-resources.tgz name: '@rush-temp/chunter-resources' version: 0.0.0 @@ -18026,7 +18035,7 @@ packages: dev: false file:projects/chunter.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): - resolution: {integrity: sha512-B2Pz7GnpUA31Hb83fZQ1q9X6/iOcEkczKPZQKCD1Nrht24HS9Z6i7SE72vXcUPFsdX0UPaSmla7CI0P3oKc/Mg==, tarball: file:projects/chunter.tgz} + resolution: {integrity: sha512-smJiIU6iEoGU0Oz30Mor08eJ2/ZIlXH04X79HJqzD9q1rIBvq4KLR+iNv9j4TjExVNpehJYuTq2zqNBgBGSM9w==, tarball: file:projects/chunter.tgz} id: file:projects/chunter.tgz name: '@rush-temp/chunter' version: 0.0.0 @@ -18205,7 +18214,7 @@ packages: dev: false file:projects/contact-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(ts-node@10.9.1): - resolution: {integrity: sha512-NNyNiZh6k3d0hvff3u/ACdOhijULgmE+SxgjNWdVyptGY0/IP8uLu2CNwDSnq3M5j+yZ4gywPIZkKdPZ4FG5IQ==, tarball: file:projects/contact-resources.tgz} + resolution: {integrity: sha512-4UeqrLhyCcUboXTol2cKsbL3WlG4SA8CWSDhlgIwEmAC3UQqowbGnHmjMkf+pDree4znfESF0Sch1pho04SDDg==, tarball: file:projects/contact-resources.tgz} id: file:projects/contact-resources.tgz name: '@rush-temp/contact-resources' version: 0.0.0 @@ -18614,7 +18623,7 @@ packages: dev: false file:projects/generator.tgz(bufferutil@4.0.7)(svelte@4.2.5): - resolution: {integrity: sha512-WqJiSVlaQiwgbKKdFJwEQPa2Ush2vKE2fpdG7g7YHA9dutOf15zJRRmsHh2tOPB3uXMK9Zuwt/6Z86VaCtLcvQ==, tarball: file:projects/generator.tgz} + resolution: {integrity: sha512-bCdu7ucZf1ZuL61Q87kjGOzabTM8XkD11vvWNi7o7DPDr8ud3/aHp6y4SICqjMbUhrl/2ZEgLkUPYVCvfPifqw==, tarball: file:projects/generator.tgz} id: file:projects/generator.tgz name: '@rush-temp/generator' version: 0.0.0 @@ -19405,7 +19414,7 @@ packages: dev: false file:projects/model-activity.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-h99S1TU2W/00QUaigRyLYFQRVkDEVgftPYEQQ9rDFBriWC+jXu7A0ki5kn2DBOhMXElrVt29fH6u1apC3VSn/Q==, tarball: file:projects/model-activity.tgz} + resolution: {integrity: sha512-Fx/yJE88VjyIbfkipf4pXcHNPE7mis0NAl7OuOnSpHfDwrIwmroHlqiK39MFkhdaGNG7jXq0mS5IS6E3/Gp7Qg==, tarball: file:projects/model-activity.tgz} id: file:projects/model-activity.tgz name: '@rush-temp/model-activity' version: 0.0.0 @@ -19426,7 +19435,7 @@ packages: dev: false file:projects/model-all.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-Rkcl3FSS5XChGZeskMQWLQDsT0AH9qgeWXwmIdIZs13ZlCjEZnPdRyRu354eRIFbwiY9f0atB/Oesw1RlL5R0A==, tarball: file:projects/model-all.tgz} + resolution: {integrity: sha512-PEl4zAGjvSsQ5stSRUuj2PYcZ0BdWTkxyaJNP63dbX4U6QA5sf7BuXamJRgETTD74jA40pGRXUAMnprS6t9z4w==, tarball: file:projects/model-all.tgz} id: file:projects/model-all.tgz name: '@rush-temp/model-all' version: 0.0.0 @@ -19451,7 +19460,7 @@ packages: dev: false file:projects/model-attachment.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-ScJBJ4HDMgGndwGTTm/BcYC2YRSdWn8L2OgZkWtWL4B5BtcKOGoiA5u9DZkov/zNHquW35XsT32zY2zCxpCqXQ==, tarball: file:projects/model-attachment.tgz} + resolution: {integrity: sha512-tfIKh4gsy4ZnW70ClMfiKnGFIOz6S/vrzhJL7/Duz5CyR74+8woJjkXWS5iEO6d8XeuC1T3mpWVg2wb2FFLhmg==, tarball: file:projects/model-attachment.tgz} id: file:projects/model-attachment.tgz name: '@rush-temp/model-attachment' version: 0.0.0 @@ -19535,7 +19544,7 @@ packages: dev: false file:projects/model-chunter.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-krEyc8zzxs/qe5tQdmEK6rzvW/unCd4dl6VyVev0QPucCbW2KAsT6jSTgQx99RoG4qL5bDuNpZQVeKPJ4mVZVg==, tarball: file:projects/model-chunter.tgz} + resolution: {integrity: sha512-dKEGvo+qbnjpaBnAkCoQp5V+DRidHKAnUkaxpM87AVMf86KgbMXyauA9I5MMsiYxntETGbYKvtm+t86WHUKvsw==, tarball: file:projects/model-chunter.tgz} id: file:projects/model-chunter.tgz name: '@rush-temp/model-chunter' version: 0.0.0 @@ -19556,7 +19565,7 @@ packages: dev: false file:projects/model-contact.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-L8P7WOkR+5RqHAuVB+TTReXzNT3c2ZIEEACc6/6QG1Y7dRyg4tUAlVJC2dZsJDx3seIkT4x1K33MdQZUqZ8vng==, tarball: file:projects/model-contact.tgz} + resolution: {integrity: sha512-M46mpKqdQgbjeeHdXvxnczaR0jNyeeeCjNeIHZKbei23cva8BKI9X2CPgAKtR3UtMlpW3WMjES0YaYllG4XSzw==, tarball: file:projects/model-contact.tgz} id: file:projects/model-contact.tgz name: '@rush-temp/model-contact' version: 0.0.0 @@ -19621,7 +19630,7 @@ packages: dev: false file:projects/model-hr.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-XAFnodBxPnnUfZ6BoXhKfgOsZdorvnDHcD4SB4RcBuxCaiqEcGvwLIM8Ju1fRS9ve8Vw8vYID8DDV3SHG0zUcw==, tarball: file:projects/model-hr.tgz} + resolution: {integrity: sha512-UBeHLgRS2KIY+XTo/250tjhfqPD7zLv3cBGLK2FcV0hV+X/a6/6prm5d3NvK1vtO5TLwXmKRbws2Ceu1TlqlHA==, tarball: file:projects/model-hr.tgz} id: file:projects/model-hr.tgz name: '@rush-temp/model-hr' version: 0.0.0 @@ -19642,7 +19651,7 @@ packages: dev: false file:projects/model-inventory.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-yeVONwzUERSl/byljh8wOhy3bIrJtgDrVm8acBe3labVP1c0N+OZI5hKw8vuNwit0eZfWrSN7XROBq1J/D4lqA==, tarball: file:projects/model-inventory.tgz} + resolution: {integrity: sha512-qYr/7r2WlSUcUtcN3oWdUrPd6uyTx8JiKjpsbFOX+vcqTZpZdhDQJSswbk6g5NSdw7MsZfFoA7l4h9vCXI0OIg==, tarball: file:projects/model-inventory.tgz} id: file:projects/model-inventory.tgz name: '@rush-temp/model-inventory' version: 0.0.0 @@ -19663,7 +19672,7 @@ packages: dev: false file:projects/model-lead.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-bWWfPoFmx7IpwRci83NyRUA5Eb3Cq4UXlXbMQUZo8oEcaslbN+6r720qxt6UrbInutM+FKG5H/O0LVh3vebEXQ==, tarball: file:projects/model-lead.tgz} + resolution: {integrity: sha512-WYB9YatMv90U6eoANMNLyRGiiggqyG2e0R8X8HlKTQ0fuuvuC5WXCJb+cJpobKbPTLiFKQ/yw2tHKjiXxgzyQA==, tarball: file:projects/model-lead.tgz} id: file:projects/model-lead.tgz name: '@rush-temp/model-lead' version: 0.0.0 @@ -19747,7 +19756,7 @@ packages: dev: false file:projects/model-recruit.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-GhR4U4IsfC7Vf9izqW7yNlHyF3eiG/IhzQBdj44KaHk9nc8Kli4OR/Z0V08M8IIxAVWW1hrkuzw7fTbNZCk6LA==, tarball: file:projects/model-recruit.tgz} + resolution: {integrity: sha512-JQlaVZDojvVRJ4gGlmdZBnXGM2vXijUYOuAS06+s4TBrw1JzZ8dLpkVat38F+sys6uSR05sIC9dLU89EyewfLg==, tarball: file:projects/model-recruit.tgz} id: file:projects/model-recruit.tgz name: '@rush-temp/model-recruit' version: 0.0.0 @@ -19789,6 +19798,27 @@ packages: - typescript dev: false + file:projects/model-server-activity.tgz(svelte@4.2.5)(typescript@5.2.2): + resolution: {integrity: sha512-ddPj4Y8/1G2ItDMmgLbaasdkjTTY66I3XKmyV3KfZNjeRq7DJZquF5VG1GM09TpfAkQkLJBJcoHoqtqQ9OgluA==, tarball: file:projects/model-server-activity.tgz} + id: file:projects/model-server-activity.tgz + name: '@rush-temp/model-server-activity' + version: 0.0.0 + dependencies: + '@typescript-eslint/eslint-plugin': 6.11.0(@typescript-eslint/parser@6.11.0)(eslint@8.54.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.11.0(eslint@8.54.0)(typescript@5.2.2) + eslint: 8.54.0 + eslint-config-standard-with-typescript: 40.0.0(@typescript-eslint/eslint-plugin@6.11.0)(eslint-plugin-import@2.28.1)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.54.0)(typescript@5.2.2) + eslint-plugin-import: 2.28.1(eslint@8.54.0) + eslint-plugin-n: 15.7.0(eslint@8.54.0) + eslint-plugin-promise: 6.1.1(eslint@8.54.0) + prettier: 3.1.0 + prettier-plugin-svelte: 3.1.0(prettier@3.1.0)(svelte@4.2.5) + transitivePeerDependencies: + - supports-color + - svelte + - typescript + dev: false + file:projects/model-server-attachment.tgz(svelte@4.2.5)(typescript@5.2.2): resolution: {integrity: sha512-n2Qsi8ZMslvChqvzREluoqFZUIn0NKrOini0P+lYqCnQpWdhT5GRUFdcq0uzw5WXSssyh5su2Hv7B9PWmK23pA==, tarball: file:projects/model-server-attachment.tgz} id: file:projects/model-server-attachment.tgz @@ -19979,7 +20009,7 @@ packages: dev: false file:projects/model-server-notification.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-4F8IILvkrQD0AD9NOXKjHQLO/vEmgqbGAFg97Jg1KSgQQCLTbai0Igh67eP+CQEolOIKNgn2Jy315UlUd+ZmEw==, tarball: file:projects/model-server-notification.tgz} + resolution: {integrity: sha512-BmWHvQtuRizjJE87k3thPWrhHJBfOEx1tg62HmPHUMsWxoS6nBKVzTa4zzwFqHPb4tlzBS7S8ux1n5tTwtJiMQ==, tarball: file:projects/model-server-notification.tgz} id: file:projects/model-server-notification.tgz name: '@rush-temp/model-server-notification' version: 0.0.0 @@ -20000,7 +20030,7 @@ packages: dev: false file:projects/model-server-openai.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-F3GyJcngnQm+XiZOom711tSgbyDnxPesEMrF5E99OcAo/OSAuq5FRuQApJIiSvIzxG3OkY5d9xg1fdqa/se27A==, tarball: file:projects/model-server-openai.tgz} + resolution: {integrity: sha512-Y1pj31vk0lLKbre1OFF7s/GCeeaybWeJz2OAecowV5DvM4TV6kmhdbzy/Yxm/OpSdSv5eeNQt0NMMg+OhBkPHQ==, tarball: file:projects/model-server-openai.tgz} id: file:projects/model-server-openai.tgz name: '@rush-temp/model-server-openai' version: 0.0.0 @@ -20273,7 +20303,7 @@ packages: dev: false file:projects/model-task.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-/XjIgfOs85WSw9zRSG1qO85SgLU+V0H4BWMSg7bRznAPcikjvgpcItgaNslZZfU7+k/QSyKl+1CF97TdXqH0dQ==, tarball: file:projects/model-task.tgz} + resolution: {integrity: sha512-56qSfouGLl0idf3X7qFQVjeAmCT0eg2iDPoErUQzeQpaYgJ2sbI1wp0Czj3hDm83NlA0eiIYkOIgqtHuSULM7w==, tarball: file:projects/model-task.tgz} id: file:projects/model-task.tgz name: '@rush-temp/model-task' version: 0.0.0 @@ -20357,7 +20387,7 @@ packages: dev: false file:projects/model-tracker.tgz(svelte@4.2.5)(typescript@5.2.2): - resolution: {integrity: sha512-Y2c+Z8HD/+Y1TM/YunTdFgA7psJjgf6SPFXREQSFXE8Xl+lEFg9UCiQlNDEjuyYEVbwgTWKw96jdTlcZnW7p6w==, tarball: file:projects/model-tracker.tgz} + resolution: {integrity: sha512-m+LFruPo0Q57JMp+IgOv3junFBwLU8sDR/rNtCJS/5ZP8RyR95iTVex5LhzuExj1G5vvrpanWyuO8DXoA+DEmg==, tarball: file:projects/model-tracker.tgz} id: file:projects/model-tracker.tgz name: '@rush-temp/model-tracker' version: 0.0.0 @@ -20567,7 +20597,7 @@ packages: dev: false file:projects/notification.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(svelte@4.2.5)(ts-node@10.9.1)(typescript@5.2.2): - resolution: {integrity: sha512-oNhayGgvuFovvHZ4jXtAQg4j2EvLraxND2eh1kFBvkwgIMN7yE6Y2Fu+298r4A6Es69WO9tKicFJN8HXMxnUFw==, tarball: file:projects/notification.tgz} + resolution: {integrity: sha512-ar2cczMbBPlEJLB9iMq+CyXItQyV5U1AFGt0XDpV2VtotNt0zGvRX9xNddmhZR3WnfPoiJ+dgK+9zErCsOKUVQ==, tarball: file:projects/notification.tgz} id: file:projects/notification.tgz name: '@rush-temp/notification' version: 0.0.0 @@ -20611,7 +20641,7 @@ packages: dev: false file:projects/openai.tgz(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): - resolution: {integrity: sha512-2CuxM12rHcF5scfPqNHy+a6+Zb0f7Ff1Pi2jxSitF3QCVlxjc/RRemwcBBlnbqDVK3OMooYsGhIvFaV5c4b3AA==, tarball: file:projects/openai.tgz} + resolution: {integrity: sha512-UHhuZXtZmgJWqGKl5NeenuYo69rrXtEsdind7OXNXM7MRmli9p0l66mX2fqAKgioALCU6nYFqtB1VCSPO4w+OQ==, tarball: file:projects/openai.tgz} id: file:projects/openai.tgz name: '@rush-temp/openai' version: 0.0.0 @@ -20914,7 +20944,7 @@ packages: dev: false file:projects/pod-server.tgz(svelte@4.2.5): - resolution: {integrity: sha512-KcjxWIMH/sM3O1t4304w4M8u6lR5S4s8SD12ffCTtZvtAKcp69LQm+qa4BQyz+rxw3Z5VYWE5A27wOZdk4Zyng==, tarball: file:projects/pod-server.tgz} + resolution: {integrity: sha512-7Griqc83Xh/jubUWlO8qA+Cx1+2pjzZgouGteeQZXfCokol6X813h3O5vkKO3fenjg6doFII5zI+DJx1R4jBnQ==, tarball: file:projects/pod-server.tgz} id: file:projects/pod-server.tgz name: '@rush-temp/pod-server' version: 0.0.0 @@ -21062,7 +21092,7 @@ packages: dev: false file:projects/prod.tgz(bufferutil@4.0.7)(esbuild@0.16.17)(sass@1.69.0)(ts-node@10.9.1)(typescript@5.2.2): - resolution: {integrity: sha512-x0wE4A9teW8YW6GDoACqUW5C+62fV944pyLE6JdqfVgqQJekR8lraKzh/R+refqKGjiUoZE2oHjj53Jc7w/n/g==, tarball: file:projects/prod.tgz} + resolution: {integrity: sha512-AMQUJ8O71HSvI9iGDSj/32iyRs75Qepku6ir0Xq6n2/IwVW4BE3n0Fzhh5tfFTsbPtjL2p4qcA0mmJ0zg28D+g==, tarball: file:projects/prod.tgz} id: file:projects/prod.tgz name: '@rush-temp/prod' version: 0.0.0 @@ -21365,7 +21395,7 @@ packages: dev: false file:projects/request.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): - resolution: {integrity: sha512-zd3j5QUy82jmuGhaPB2ZvI0kR1kE8m0IUdU7ICnsFYfwk1UL3IPYZ1tkAPlYmNwWpYJ16Ll6pkq96hXNXdOIbg==, tarball: file:projects/request.tgz} + resolution: {integrity: sha512-RH9Wtmwqxgp8ByBW5JJmLNai8oD3GYCgGJQqQHRJKmoU0h+nOBA6apNFp42PRE0U4GIyD0U88hILq1VILae7aA==, tarball: file:projects/request.tgz} id: file:projects/request.tgz name: '@rush-temp/request' version: 0.0.0 @@ -21430,6 +21460,70 @@ packages: - ts-node dev: false + file:projects/server-activity-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): + resolution: {integrity: sha512-NJwDYiOdiOtH/MMY/pcUduYzJIBgDHdVwmquqQ82r0Dg39c/Zz8de7At1VrAnvnfpbSSKFZLsBC8GtfGwdIHRA==, tarball: file:projects/server-activity-resources.tgz} + id: file:projects/server-activity-resources.tgz + name: '@rush-temp/server-activity-resources' + version: 0.0.0 + dependencies: + '@types/jest': 29.5.5 + '@typescript-eslint/eslint-plugin': 6.11.0(@typescript-eslint/parser@6.11.0)(eslint@8.54.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.11.0(eslint@8.54.0)(typescript@5.2.2) + eslint: 8.54.0 + eslint-config-standard-with-typescript: 40.0.0(@typescript-eslint/eslint-plugin@6.11.0)(eslint-plugin-import@2.28.1)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.54.0)(typescript@5.2.2) + eslint-plugin-import: 2.28.1(eslint@8.54.0) + eslint-plugin-n: 15.7.0(eslint@8.54.0) + eslint-plugin-promise: 6.1.1(eslint@8.54.0) + jest: 29.7.0(@types/node@16.11.68)(ts-node@10.9.1) + prettier: 3.1.0 + prettier-plugin-svelte: 3.1.0(prettier@3.1.0)(svelte@4.2.5) + ts-jest: 29.1.1(esbuild@0.16.17)(jest@29.7.0)(typescript@5.2.2) + typescript: 5.2.2 + transitivePeerDependencies: + - '@babel/core' + - '@jest/types' + - '@types/node' + - babel-jest + - babel-plugin-macros + - esbuild + - node-notifier + - supports-color + - svelte + - ts-node + dev: false + + file:projects/server-activity.tgz(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): + resolution: {integrity: sha512-DneWyxHhW1vXrtKGwcLBuE7tkcbRkQVg4L/X4YamviGOuSWNSwUMb4KeJk7tqRhNwt0ldg3GcXvP7p01oPyVnA==, tarball: file:projects/server-activity.tgz} + id: file:projects/server-activity.tgz + name: '@rush-temp/server-activity' + version: 0.0.0 + dependencies: + '@types/jest': 29.5.5 + '@types/node': 16.11.68 + '@typescript-eslint/eslint-plugin': 6.11.0(@typescript-eslint/parser@6.11.0)(eslint@8.54.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.11.0(eslint@8.54.0)(typescript@5.2.2) + eslint: 8.54.0 + eslint-config-standard-with-typescript: 40.0.0(@typescript-eslint/eslint-plugin@6.11.0)(eslint-plugin-import@2.28.1)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.54.0)(typescript@5.2.2) + eslint-plugin-import: 2.28.1(eslint@8.54.0) + eslint-plugin-n: 15.7.0(eslint@8.54.0) + eslint-plugin-promise: 6.1.1(eslint@8.54.0) + jest: 29.7.0(@types/node@16.11.68)(ts-node@10.9.1) + prettier: 3.1.0 + prettier-plugin-svelte: 3.1.0(prettier@3.1.0)(svelte@4.2.5) + ts-jest: 29.1.1(esbuild@0.16.17)(jest@29.7.0)(typescript@5.2.2) + typescript: 5.2.2 + transitivePeerDependencies: + - '@babel/core' + - '@jest/types' + - babel-jest + - babel-plugin-macros + - esbuild + - node-notifier + - supports-color + - svelte + - ts-node + dev: false + file:projects/server-attachment-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): resolution: {integrity: sha512-25yaizWNA1rXmhGvsw6fz5Vg03LXTF2uL+oLaM56GxI5gZnP2t/vixxD+7G1CJT2YNcFaK1HiqCDUrjMN2zQ5g==, tarball: file:projects/server-attachment-resources.tgz} id: file:projects/server-attachment-resources.tgz @@ -22012,7 +22106,7 @@ packages: dev: false file:projects/server-notification-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): - resolution: {integrity: sha512-ULb1Qwv/+6OqeJCA3DxrvUmzQg9yAGMO5vioAc/C+l0aVzNpfVJPKIX03NGlGe7CvT4Ys3w0xXEusFJ7+pawhw==, tarball: file:projects/server-notification-resources.tgz} + resolution: {integrity: sha512-MB40NnTz/EsrbX5vaVJp4Ste2YhwqLP9MXzH/9Vw3gfL/2hbbegKWzemMKiH8lU4/EQoTd0ay6YhVUWLSe1eBA==, tarball: file:projects/server-notification-resources.tgz} id: file:projects/server-notification-resources.tgz name: '@rush-temp/server-notification-resources' version: 0.0.0 @@ -22563,7 +22657,7 @@ packages: dev: false file:projects/server-tracker-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): - resolution: {integrity: sha512-rzxlBU4Qtlyl6AO2W9zl7OY1GqKFrsbcZeenImwi2A3L+d79DYg2IWm+3ay8feGL6TVsOYZTwapA/yTyBD/1eg==, tarball: file:projects/server-tracker-resources.tgz} + resolution: {integrity: sha512-eP7iOhbsVOTizFoVY89Fk5u29U3U9y1EqKA9thJX/xy7E6WIsB9FZv0pfyBNPR0RTbvEEOb8lAhJmogmKijaoQ==, tarball: file:projects/server-tracker-resources.tgz} id: file:projects/server-tracker-resources.tgz name: '@rush-temp/server-tracker-resources' version: 0.0.0 @@ -23697,7 +23791,7 @@ packages: dev: false file:projects/tool.tgz(bufferutil@4.0.7)(svelte@4.2.5): - resolution: {integrity: sha512-YiOLUsyhvShU6cXfy9vf+CMJ+i0fQlj/nP5izXKEgU3/pzMwCnbWDlwkk5HKVplbPh1o/mx5s6m9cFt4Gp5Tng==, tarball: file:projects/tool.tgz} + resolution: {integrity: sha512-/U8HgaP/9AhnOrrWwdMZEkYyQtGxiUbTFjywYBbPv4LMgEB9YdAhgGF3N/nO/QbeSEgTWGVEn25pbGv7GT5I0Q==, tarball: file:projects/tool.tgz} id: file:projects/tool.tgz name: '@rush-temp/tool' version: 0.0.0 diff --git a/dev/generator/package.json b/dev/generator/package.json index b7ef8e5286..f86db4ce46 100644 --- a/dev/generator/package.json +++ b/dev/generator/package.json @@ -39,6 +39,7 @@ "dependencies": { "@hcengineering/account": "^0.6.0", "@hcengineering/attachment": "^0.6.9", + "@hcengineering/chunter": "^0.6.12", "@hcengineering/client": "^0.6.14", "@hcengineering/client-resources": "^0.6.23", "@hcengineering/contact": "^0.6.20", @@ -54,7 +55,6 @@ "@hcengineering/task": "^0.6.13", "@hcengineering/telegram": "^0.6.14", "@hcengineering/tracker": "^0.6.13", - "@hcengineering/notification": "^0.6.16", "@types/pdfkit": "~0.12.3", "commander": "^8.1.0", "faker": "~5.5.3", diff --git a/dev/generator/src/comments.ts b/dev/generator/src/comments.ts index fe314a736d..9f2936c9a6 100644 --- a/dev/generator/src/comments.ts +++ b/dev/generator/src/comments.ts @@ -1,5 +1,5 @@ +import chunter, { ChatMessage } from '@hcengineering/chunter' import { AttachedData, Class, Doc, generateId, Ref, Space, TxOperations } from '@hcengineering/core' -import notification, { ChatMessage } from '@hcengineering/notification' import faker from 'faker' export interface CommentOptions { @@ -25,20 +25,12 @@ export async function addComments ( const commentData: AttachedData = { message: faker.lorem.paragraphs(options.paragraphMin + faker.datatype.number(options.paragraphMax)) } - await client.addCollection( - notification.class.ChatMessage, - space, - objectId, - _class, - collection, - commentData, - commentId - ) + await client.addCollection(chunter.class.ChatMessage, space, objectId, _class, collection, commentData, commentId) if (faker.datatype.number(100) > options.updateFactor) { const updateMsg = faker.lorem.paragraphs(options.paragraphMin + faker.datatype.number(options.paragraphMax)) - await client.updateCollection(notification.class.ChatMessage, space, commentId, objectId, _class, collection, { + await client.updateCollection(chunter.class.ChatMessage, space, commentId, objectId, _class, collection, { message: updateMsg }) } diff --git a/dev/prod/package.json b/dev/prod/package.json index 0bcbf95d64..aa70d6ece0 100644 --- a/dev/prod/package.json +++ b/dev/prod/package.json @@ -167,6 +167,8 @@ "@hcengineering/server-request": "^0.6.0", "@hcengineering/server-request-resources": "^0.6.0", "@hcengineering/server-view": "^0.6.0", - "@hcengineering/server-view-resources": "^0.6.0" + "@hcengineering/server-view-resources": "^0.6.0", + "@hcengineering/server-activity": "^0.6.0", + "@hcengineering/server-activity-resources": "^0.6.0" } } diff --git a/dev/tool/package.json b/dev/tool/package.json index 33f918d8fd..206a27e32a 100644 --- a/dev/tool/package.json +++ b/dev/tool/package.json @@ -49,6 +49,7 @@ "@elastic/elasticsearch": "^7.14.0", "@hcengineering/account": "^0.6.0", "@hcengineering/attachment": "^0.6.9", + "@hcengineering/chunter": "^0.6.12", "@hcengineering/client": "^0.6.14", "@hcengineering/client-resources": "^0.6.23", "@hcengineering/contact": "^0.6.20", @@ -64,7 +65,6 @@ "@hcengineering/model-recruit": "^0.6.0", "@hcengineering/model-telegram": "^0.6.0", "@hcengineering/mongo": "^0.6.1", - "@hcengineering/notification": "^0.6.16", "@hcengineering/openai": "^0.6.0", "@hcengineering/platform": "^0.6.9", "@hcengineering/recruit": "^0.6.21", @@ -107,6 +107,8 @@ "@hcengineering/server-tracker-resources": "^0.6.0", "@hcengineering/server-view": "^0.6.0", "@hcengineering/server-view-resources": "^0.6.0", + "@hcengineering/server-activity": "^0.6.0", + "@hcengineering/server-activity-resources": "^0.6.0", "@hcengineering/setting": "^0.6.11", "@hcengineering/tags": "^0.6.12", "@hcengineering/task": "^0.6.13", diff --git a/dev/tool/src/__start.ts b/dev/tool/src/__start.ts index 62b0ba42b6..99239b1d50 100644 --- a/dev/tool/src/__start.ts +++ b/dev/tool/src/__start.ts @@ -22,6 +22,7 @@ import builder, { migrateOperations, version } from '@hcengineering/model-all' import { devTool } from '.' import { addLocation } from '@hcengineering/platform' +import { serverActivityId } from '@hcengineering/server-activity' import { serverAttachmentId } from '@hcengineering/server-attachment' import { serverCalendarId } from '@hcengineering/server-calendar' import { serverChunterId } from '@hcengineering/server-chunter' @@ -40,6 +41,7 @@ import { serverTelegramId } from '@hcengineering/server-telegram' import { serverTrackerId } from '@hcengineering/server-tracker' import { serverViewId } from '@hcengineering/server-view' +addLocation(serverActivityId, () => import('@hcengineering/server-activity-resources')) addLocation(serverAttachmentId, () => import('@hcengineering/server-attachment-resources')) addLocation(serverContactId, () => import('@hcengineering/server-contact-resources')) addLocation(serverNotificationId, () => import('@hcengineering/server-notification-resources')) diff --git a/dev/tool/src/clean.ts b/dev/tool/src/clean.ts index 3303c21646..a13b46b4aa 100644 --- a/dev/tool/src/clean.ts +++ b/dev/tool/src/clean.ts @@ -38,9 +38,9 @@ import { connect } from '@hcengineering/server-tool' import tracker from '@hcengineering/tracker' import tags, { TagCategory, TagElement, TagReference } from '@hcengineering/tags' import { MongoClient } from 'mongodb' -import notification, { ChatMessage } from '@hcengineering/notification' +import chunter, { ChatMessage } from '@hcengineering/chunter' -export const DOMAIN_COMMENT = 'comment' as Domain +export const DOMAIN_CHUNTER = 'chunter' as Domain export async function cleanWorkspace ( mongoUrl: string, @@ -322,11 +322,11 @@ export async function fixCommentDoubleIdCreate (workspaceId: WorkspaceId, transa try { const commentTxes = await connection.findAll(core.class.TxCollectionCUD, { 'tx._class': core.class.TxCreateDoc, - 'tx.objectClass': notification.class.ChatMessage + 'tx.objectClass': chunter.class.ChatMessage }) const commentTxesRemoved = await connection.findAll(core.class.TxCollectionCUD, { 'tx._class': core.class.TxRemoveDoc, - 'tx.objectClass': notification.class.ChatMessage + 'tx.objectClass': chunter.class.ChatMessage }) const removed = new Map(commentTxesRemoved.map((it) => [it.tx.objectId, it])) // Do not checked removed @@ -354,7 +354,7 @@ export async function fixCommentDoubleIdCreate (workspaceId: WorkspaceId, transa doc._id = c.tx.objectId as Ref await connection.upload(DOMAIN_TX, [c]) // Also we need to create snapsot - await connection.upload(DOMAIN_COMMENT, [doc]) + await connection.upload(DOMAIN_CHUNTER, [doc]) } } } diff --git a/dev/tool/src/mixin.ts b/dev/tool/src/mixin.ts index dd65295baf..e2d27c1443 100644 --- a/dev/tool/src/mixin.ts +++ b/dev/tool/src/mixin.ts @@ -31,8 +31,6 @@ import { getWorkspaceDB } from '@hcengineering/mongo' import { connect } from '@hcengineering/server-tool' import { MongoClient } from 'mongodb' -export const DOMAIN_COMMENT = 'comment' as Domain - interface PropertyInfo { name: string cValue: any diff --git a/models/activity/package.json b/models/activity/package.json index fe1ddfcaa9..4cb6b4a161 100644 --- a/models/activity/package.json +++ b/models/activity/package.json @@ -31,6 +31,7 @@ "@hcengineering/model": "^0.6.7", "@hcengineering/model-core": "^0.6.0", "@hcengineering/platform": "^0.6.9", - "@hcengineering/ui": "^0.6.11" + "@hcengineering/ui": "^0.6.11", + "@hcengineering/model-view": "^0.6.0" } } diff --git a/models/activity/src/index.ts b/models/activity/src/index.ts index 42b8a3b812..8eb152b059 100644 --- a/models/activity/src/index.ts +++ b/models/activity/src/index.ts @@ -13,17 +13,63 @@ // limitations under the License. // -import type { TxViewlet } from '@hcengineering/activity' -import core, { DOMAIN_MODEL, type Class, type Doc, type DocumentQuery, type Ref, type Tx } from '@hcengineering/core' -import { Model, type Builder } from '@hcengineering/model' -import { TDoc } from '@hcengineering/model-core' -import type { Asset, IntlString } from '@hcengineering/platform' +import { + type ActivityDoc, + type ActivityExtension, + type ActivityExtensionKind, + type ActivityMessage, + type ActivityMessageExtension, + type ActivityMessageExtensionKind, + type ActivityMessagesFilter, + type DocAttributeUpdates, + type DocUpdateAction, + type DocUpdateMessage, + type DocUpdateMessageViewlet, + type DocUpdateMessageViewletAttributesConfig, + type Reaction, + type TxViewlet +} from '@hcengineering/activity' +import core, { + DOMAIN_MODEL, + type Class, + type Doc, + type DocumentQuery, + type Ref, + type Tx, + IndexKind, + type TxCUD, + type Domain, + type Account +} from '@hcengineering/core' +import { + Model, + type Builder, + Prop, + Index, + TypeRef, + TypeString, + Mixin, + Collection, + TypeBoolean +} from '@hcengineering/model' +import { TAttachedDoc, TClass, TDoc } from '@hcengineering/model-core' +import type { Asset, IntlString, Resource } from '@hcengineering/platform' import { type AnyComponent } from '@hcengineering/ui/src/types' import activity from './plugin' +import view from '@hcengineering/model-view' +export { activityOperation } from './migration' export { activityId } from '@hcengineering/activity' +export const DOMAIN_ACTIVITY = 'activity' as Domain + +@Mixin(activity.mixin.ActivityDoc, core.class.Class) +export class TActivityDoc extends TClass implements ActivityDoc { + preposition?: IntlString + ignoreCollections?: string[] +} + @Model(activity.class.TxViewlet, core.class.Doc, DOMAIN_MODEL) export class TTxViewlet extends TDoc implements TxViewlet { icon!: Asset @@ -39,8 +85,141 @@ export class TTxViewlet extends TDoc implements TxViewlet { hideOnRemove!: boolean } +@Model(activity.class.ActivityMessage, core.class.AttachedDoc, DOMAIN_ACTIVITY) +export class TActivityMessage extends TAttachedDoc implements ActivityMessage { + @Prop(TypeBoolean(), activity.string.Pinned) + isPinned?: boolean + + @Prop(Collection(activity.class.Reaction), activity.string.Reactions) + reactions?: number +} + +@Model(activity.class.DocUpdateMessage, activity.class.ActivityMessage, DOMAIN_ACTIVITY) +export class TDocUpdateMessage extends TActivityMessage implements DocUpdateMessage { + @Prop(TypeRef(core.class.Doc), core.string.Object) + @Index(IndexKind.Indexed) + objectId!: Ref + + @Prop(TypeRef(core.class.Class), core.string.Class) + @Index(IndexKind.Indexed) + objectClass!: Ref> + + @Prop(TypeRef(core.class.TxCUD), core.string.Object) + @Index(IndexKind.Indexed) + txId!: Ref> + + action!: DocUpdateAction + updateCollection?: string + attributeUpdates?: DocAttributeUpdates +} + +@Model(activity.class.DocUpdateMessageViewlet, core.class.Doc, DOMAIN_MODEL) +export class TDocUpdateMessageViewlet extends TDoc implements DocUpdateMessageViewlet { + @Prop(TypeRef(core.class.Doc), core.string.Class) + @Index(IndexKind.Indexed) + objectClass!: Ref> + + @Prop(TypeString(), core.string.String) + @Index(IndexKind.Indexed) + action!: DocUpdateAction + + label?: IntlString + labelComponent?: AnyComponent + + valueAttr?: string + + icon?: Asset + component?: AnyComponent + config?: DocUpdateMessageViewletAttributesConfig + hideIfRemoved?: boolean + onlyWithParent?: boolean +} + +@Model(activity.class.ActivityMessageExtension, core.class.Doc, DOMAIN_MODEL) +export class TActivityMessageExtension extends TDoc implements ActivityMessageExtension { + @Prop(TypeRef(activity.class.ActivityMessage), core.string.Class) + @Index(IndexKind.Indexed) + ofMessage!: Ref> + + components!: { kind: ActivityMessageExtensionKind, component: AnyComponent }[] +} + +@Model(activity.class.ActivityExtension, core.class.Doc, DOMAIN_MODEL) +export class TActivityExtension extends TDoc implements ActivityExtension { + @Prop(TypeRef(core.class.Class), core.string.Class) + @Index(IndexKind.Indexed) + ofClass!: Ref> + + components!: Record +} + +@Model(activity.class.ActivityMessagesFilter, core.class.Doc, DOMAIN_MODEL) +export class TActivityMessagesFilter extends TDoc implements ActivityMessagesFilter { + label!: IntlString + filter!: Resource<(message: ActivityMessage, _class?: Ref) => boolean> +} + +@Model(activity.class.Reaction, core.class.AttachedDoc, DOMAIN_ACTIVITY) +export class TReaction extends TAttachedDoc implements Reaction { + @Prop(TypeString(), activity.string.Emoji) + emoji!: string + + @Prop(TypeRef(core.class.Account), view.string.Created) + createBy!: Ref +} export function createModel (builder: Builder): void { - builder.createModel(TTxViewlet) + builder.createModel( + TTxViewlet, + TActivityDoc, + TActivityMessagesFilter, + TActivityMessageExtension, + TActivityMessage, + TDocUpdateMessage, + TDocUpdateMessageViewlet, + TActivityExtension, + TReaction + ) + + builder.mixin(activity.class.DocUpdateMessage, core.class.Class, activity.mixin.ActivityDoc, {}) + + builder.mixin(activity.class.DocUpdateMessage, core.class.Class, view.mixin.ObjectPresenter, { + presenter: activity.component.DocUpdateMessagePresenter + }) + + builder.createDoc(activity.class.ActivityMessagesFilter, core.space.Model, { + label: activity.string.Attributes, + filter: activity.filter.AttributesFilter + }) + + builder.createDoc(activity.class.ActivityMessagesFilter, core.space.Model, { + label: activity.string.Pinned, + filter: activity.filter.PinnedFilter + }) + + builder.createDoc( + activity.class.DocUpdateMessageViewlet, + core.space.Model, + { + objectClass: activity.class.Reaction, + action: 'create', + component: activity.component.ReactionAddedMessage, + label: activity.string.Reacted, + onlyWithParent: true, + hideIfRemoved: true + }, + activity.ids.ReactionAddedActivityViewlet + ) + + builder.createDoc( + activity.class.DocUpdateMessageViewlet, + core.space.Model, + { + objectClass: activity.class.Reaction, + action: 'remove', + hideIfRemoved: true + }, + activity.ids.ReactionRemovedActivityViewlet + ) } export default activity diff --git a/models/activity/src/migration.ts b/models/activity/src/migration.ts new file mode 100644 index 0000000000..d566c275bc --- /dev/null +++ b/models/activity/src/migration.ts @@ -0,0 +1,48 @@ +// +// Copyright © 2022 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { type Class, type Doc, type Domain, type Ref } from '@hcengineering/core' +import { + type MigrateOperation, + type MigrationClient, + type MigrationUpgradeClient, + tryMigrate +} from '@hcengineering/model' + +import activity from './plugin' +import { activityId, DOMAIN_ACTIVITY } from './index' + +const DOMAIN_CHUNTER = 'chunter' as Domain + +async function migrateReactions (client: MigrationClient): Promise { + await client.update( + DOMAIN_CHUNTER, + { _class: 'chunter:class:Reaction' as Ref> }, + { _class: activity.class.Reaction } + ) + await client.move(DOMAIN_CHUNTER, { _class: activity.class.Reaction }, DOMAIN_ACTIVITY) +} + +export const activityOperation: MigrateOperation = { + async migrate (client: MigrationClient): Promise { + await tryMigrate(client, activityId, [ + { + state: 'reactions', + func: migrateReactions + } + ]) + }, + async upgrade (client: MigrationUpgradeClient): Promise {} +} diff --git a/models/activity/src/plugin.ts b/models/activity/src/plugin.ts index ecac7b59a8..912cede81e 100644 --- a/models/activity/src/plugin.ts +++ b/models/activity/src/plugin.ts @@ -12,8 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. // -import { activityId } from '@hcengineering/activity' +import { activityId, type ActivityMessage, type DocUpdateMessageViewlet } from '@hcengineering/activity' import activity from '@hcengineering/activity-resources/src/plugin' -import { mergeIds } from '@hcengineering/platform' +import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' +import { type Doc, type Ref } from '@hcengineering/core' -export default mergeIds(activityId, activity, {}) +export default mergeIds(activityId, activity, { + string: { + Attributes: '' as IntlString, + Pinned: '' as IntlString, + Emoji: '' as IntlString, + Reacted: '' as IntlString + }, + filter: { + AttributesFilter: '' as Resource<(message: ActivityMessage, _class?: Ref) => boolean>, + PinnedFilter: '' as Resource<(message: ActivityMessage, _class?: Ref) => boolean> + }, + ids: { + ReactionAddedActivityViewlet: '' as Ref, + ReactionRemovedActivityViewlet: '' as Ref + } +}) diff --git a/models/all/package.json b/models/all/package.json index 75b3d6f898..8b724fab5c 100644 --- a/models/all/package.json +++ b/models/all/package.json @@ -77,6 +77,7 @@ "@hcengineering/model-request": "^0.6.0", "@hcengineering/model-server-request": "^0.6.0", "@hcengineering/model-server-view": "^0.6.0", + "@hcengineering/model-server-activity": "^0.6.0", "@hcengineering/model-server-openai": "^0.6.0", "@hcengineering/model-server-translate": "^0.6.0", "@hcengineering/model-support": "^0.6.0" diff --git a/models/all/src/index.ts b/models/all/src/index.ts index 23141c18d8..547f49d21e 100644 --- a/models/all/src/index.ts +++ b/models/all/src/index.ts @@ -52,6 +52,7 @@ import { serverTaskId, createModel as serverTaskModel } from '@hcengineering/mod import { serverTelegramId, createModel as serverTelegramModel } from '@hcengineering/model-server-telegram' import { serverTrackerId, createModel as serverTrackerModel } from '@hcengineering/model-server-tracker' import { serverViewId, createModel as serverViewModel } from '@hcengineering/model-server-view' +import { serverActivityId, createModel as serverActivityModel } from '@hcengineering/model-server-activity' import setting, { settingId, createModel as settingModel } from '@hcengineering/model-setting' import { supportId, createModel as supportModel } from '@hcengineering/model-support' import { tagsId, createModel as tagsModel } from '@hcengineering/model-tags' @@ -279,7 +280,7 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[ [serverNotificationModel, serverNotificationId], [serverRequestModel, serverRequestId], [serverViewModel, serverViewId], - + [serverActivityModel, serverActivityId], [serverTranslate, translateId], [serverOpenAI, openAIId] ] diff --git a/models/all/src/migration.ts b/models/all/src/migration.ts index a2fbe38b92..19daeb9b9a 100644 --- a/models/all/src/migration.ts +++ b/models/all/src/migration.ts @@ -36,10 +36,12 @@ import { boardOperation } from '@hcengineering/model-board' import { hrOperation } from '@hcengineering/model-hr' import { bitrixOperation } from '@hcengineering/model-bitrix' import { calendarOperation } from '@hcengineering/model-calendar' -import { notificationServerOperation } from '@hcengineering/model-server-notification' +import { activityOperation } from '@hcengineering/model-activity' +import { activityServerOperation } from '@hcengineering/model-server-activity' export const migrateOperations: [string, MigrateOperation][] = [ ['core', coreOperation], + ['activity', activityOperation], ['chunter', chunterOperation], ['calendar', calendarOperation], ['gmail', gmailOperation], @@ -60,5 +62,5 @@ export const migrateOperations: [string, MigrateOperation][] = [ ['hr', hrOperation], ['bitrix', bitrixOperation], ['inventiry', inventoryOperation], - ['notificationServer', notificationServerOperation] + ['activityServer', activityServerOperation] ] diff --git a/models/attachment/package.json b/models/attachment/package.json index a16d569ce8..5c92ba04bb 100644 --- a/models/attachment/package.json +++ b/models/attachment/package.json @@ -33,7 +33,6 @@ "@hcengineering/model-core": "^0.6.0", "@hcengineering/model-preference": "^0.6.0", "@hcengineering/model-view": "^0.6.0", - "@hcengineering/notification": "^0.6.16", "@hcengineering/platform": "^0.6.9", "@hcengineering/ui": "^0.6.11", "@hcengineering/view": "^0.6.9" diff --git a/models/attachment/src/index.ts b/models/attachment/src/index.ts index 97783eccea..49cc85af53 100644 --- a/models/attachment/src/index.ts +++ b/models/attachment/src/index.ts @@ -32,7 +32,6 @@ import core, { TAttachedDoc } from '@hcengineering/model-core' import preference, { TPreference } from '@hcengineering/model-preference' import view, { createAction } from '@hcengineering/model-view' import attachment from './plugin' -import notification from '@hcengineering/notification' export { attachmentId } from '@hcengineering/attachment' export { attachmentOperation } from './migration' @@ -124,32 +123,32 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: attachment.class.Attachment, action: 'create', icon: attachment.icon.Attachment, label: attachment.string.AddAttachment, - component: attachment.notification.NotificationAttachmentChanged + component: attachment.activity.AttachmentsUpdatedMessage }, - attachment.ids.NotificationAttachmentCreated + attachment.ids.AttachmentCreatedActivityViewlet ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: attachment.class.Attachment, action: 'remove', icon: attachment.icon.Attachment, label: attachment.string.RemovedAttachment, - component: attachment.notification.NotificationAttachmentChanged + component: attachment.activity.AttachmentsUpdatedMessage }, - attachment.ids.NotificationAttachmentRemoved + attachment.ids.AttachmentRemovedActivityViewlet ) - builder.createDoc(notification.class.ActivityMessagesFilter, core.space.Model, { + builder.createDoc(activity.class.ActivityMessagesFilter, core.space.Model, { label: attachment.string.FilterAttachments, filter: attachment.filter.AttachmentsFilter }) diff --git a/models/attachment/src/plugin.ts b/models/attachment/src/plugin.ts index f74e51257c..9bc47631bd 100644 --- a/models/attachment/src/plugin.ts +++ b/models/attachment/src/plugin.ts @@ -13,7 +13,7 @@ // limitations under the License. // -import type { TxViewlet } from '@hcengineering/activity' +import type { TxViewlet, 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' @@ -21,7 +21,6 @@ import type { IntlString, Resource } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' import type { AnyComponent } from '@hcengineering/ui/src/types' import type { ActionCategory } from '@hcengineering/view' -import { type ActivityMessage, type DocUpdateMessageViewlet } from '@hcengineering/notification' export default mergeIds(attachmentId, attachment, { component: { @@ -47,14 +46,12 @@ export default mergeIds(attachmentId, attachment, { ids: { TxAttachmentCreate: '' as Ref, TxAttachmentRemove: '' as Ref, - NotificationAttachmentCreated: '' as Ref, - NotificationAttachmentRemoved: '' as Ref + AttachmentCreatedActivityViewlet: '' as Ref, + AttachmentRemovedActivityViewlet: '' as Ref }, activity: { - TxAttachmentCreate: '' as AnyComponent - }, - notification: { - NotificationAttachmentChanged: '' as AnyComponent + TxAttachmentCreate: '' as AnyComponent, + AttachmentsUpdatedMessage: '' as AnyComponent }, category: { Attachments: '' as Ref diff --git a/models/calendar/src/index.ts b/models/calendar/src/index.ts index 39f5d708a0..7310c2da16 100644 --- a/models/calendar/src/index.ts +++ b/models/calendar/src/index.ts @@ -244,7 +244,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: calendar.class.Event, @@ -252,7 +252,7 @@ export function createModel (builder: Builder): void { action: 'update', hideIfRemoved: true }, - calendar.ids.UpdateRemainderNotificationViewlet + calendar.ids.UpdateRemainderActivityViewlet ) builder.createDoc( diff --git a/models/calendar/src/plugin.ts b/models/calendar/src/plugin.ts index c9f7eb6599..78980c5d22 100644 --- a/models/calendar/src/plugin.ts +++ b/models/calendar/src/plugin.ts @@ -13,11 +13,11 @@ // limitations under the License. // -import { type TxViewlet } from '@hcengineering/activity' +import { type DocUpdateMessageViewlet, type TxViewlet } from '@hcengineering/activity' import { calendarId } from '@hcengineering/calendar' import calendar from '@hcengineering/calendar-resources/src/plugin' import { type Ref } from '@hcengineering/core' -import { type DocUpdateMessageViewlet, type NotificationGroup } from '@hcengineering/notification' +import { type NotificationGroup } from '@hcengineering/notification' import type { IntlString } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' import { type AnyComponent } from '@hcengineering/ui/src/types' @@ -66,7 +66,7 @@ export default mergeIds(calendarId, calendar, { }, ids: { ReminderViewlet: '' as Ref, - UpdateRemainderNotificationViewlet: '' as Ref, + UpdateRemainderActivityViewlet: '' as Ref, CalendarNotificationGroup: '' as Ref } }) diff --git a/models/chunter/package.json b/models/chunter/package.json index 46e7318370..016006399f 100644 --- a/models/chunter/package.json +++ b/models/chunter/package.json @@ -33,6 +33,7 @@ "@hcengineering/core": "^0.6.28", "@hcengineering/model": "^0.6.7", "@hcengineering/model-attachment": "^0.6.0", + "@hcengineering/model-activity": "^0.6.0", "@hcengineering/model-core": "^0.6.0", "@hcengineering/model-notification": "^0.6.0", "@hcengineering/model-preference": "^0.6.0", diff --git a/models/chunter/src/index.ts b/models/chunter/src/index.ts index 329892ecec..5a2591ae45 100644 --- a/models/chunter/src/index.ts +++ b/models/chunter/src/index.ts @@ -24,17 +24,28 @@ import { type Comment, type DirectMessage, type Message, - type Reaction, type SavedMessages, type ThreadMessage, - type DirectMessageInput + type DirectMessageInput, + type ChatMessage, + type ChatMessageViewlet } from '@hcengineering/chunter' import contact, { type Person } from '@hcengineering/contact' -import type { Account, Class, Doc, Domain, Ref, Space, Timestamp } from '@hcengineering/core' -import { IndexKind } from '@hcengineering/core' +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, @@ -48,7 +59,7 @@ import { UX } from '@hcengineering/model' import attachment from '@hcengineering/model-attachment' -import core, { TAttachedDoc, TClass, TSpace } from '@hcengineering/model-core' +import core, { TAttachedDoc, TClass, TDoc, TSpace } from '@hcengineering/model-core' import notification from '@hcengineering/model-notification' import preference, { TPreference } from '@hcengineering/model-preference' import view, { createAction, actionTemplates as viewTemplates } from '@hcengineering/model-view' @@ -56,6 +67,8 @@ import workbench from '@hcengineering/model-workbench' import chunter from './plugin' import { type AnyComponent } from '@hcengineering/ui/src/types' import { TypeBoolean } from '@hcengineering/model' +import type { IntlString } from '@hcengineering/platform' +import { TActivityMessage } from '@hcengineering/model-activity' export { chunterId } from '@hcengineering/chunter' export { chunterOperation } from './migration' @@ -99,7 +112,7 @@ export class TChunterMessage extends TAttachedDoc implements ChunterMessage { @Prop(TypeTimestamp(), chunter.string.Edit) editedOn?: Timestamp - @Prop(Collection(chunter.class.Reaction), chunter.string.Reactions) + @Prop(Collection(activity.class.Reaction), activity.string.Reactions) reactions?: number } @@ -130,18 +143,6 @@ export class TMessage extends TChunterMessage implements Message { lastReply?: Timestamp } -@Model(chunter.class.Reaction, core.class.AttachedDoc, DOMAIN_CHUNTER) -export class TReaction extends TAttachedDoc implements Reaction { - @Prop(TypeString(), chunter.string.Emoji) - emoji!: string - - @Prop(TypeRef(core.class.Account), chunter.string.CreateBy) - createBy!: Ref - - declare attachedTo: Ref - declare attachedToClass: Ref> -} - @Model(chunter.class.Comment, core.class.AttachedDoc, DOMAIN_COMMENT) @UX(chunter.string.Comment, undefined, 'COM') export class TComment extends TAttachedDoc implements Comment { @@ -152,7 +153,7 @@ export class TComment extends TAttachedDoc implements Comment { @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) attachments?: number - @Prop(Collection(chunter.class.Reaction), chunter.string.Reactions) + @Prop(Collection(activity.class.Reaction), activity.string.Reactions) reactions?: number @Prop(TypeBoolean(), chunter.string.PinMessage) @@ -177,6 +178,31 @@ export class TDirectMessageInput extends TClass implements DirectMessageInput { component!: AnyComponent } +@Model(chunter.class.ChatMessage, activity.class.ActivityMessage, DOMAIN_CHUNTER) +export class TChatMessage extends TActivityMessage implements ChatMessage { + @Prop(TypeMarkup(), chunter.string.Message) + @Index(IndexKind.FullText) + message!: string + + @Prop(PropCollection(attachment.class.Attachment), attachment.string.Attachments, { + shortLabel: attachment.string.Files + }) + attachments?: number + + @Prop(TypeBoolean(), core.string.Boolean) + isEdited?: boolean +} + +@Model(chunter.class.ChatMessageViewlet, core.class.Doc, DOMAIN_MODEL) +export class TChatMessageViewlet extends TDoc implements ChatMessageViewlet { + @Prop(TypeRef(core.class.Doc), core.string.Class) + @Index(IndexKind.Indexed) + objectClass!: Ref> + + label?: IntlString + onlyWithParent?: boolean +} + export function createModel (builder: Builder, options = { addApplication: true }): void { builder.createModel( TChunterSpace, @@ -189,13 +215,14 @@ export function createModel (builder: Builder, options = { addApplication: true TBacklink, TDirectMessage, TSavedMessages, - TReaction, - TDirectMessageInput + TDirectMessageInput, + TChatMessage, + TChatMessageViewlet ) const spaceClasses = [chunter.class.Channel, chunter.class.DirectMessage] spaceClasses.forEach((spaceClass) => { - builder.mixin(spaceClass, core.class.Class, notification.mixin.ActivityDoc, {}) + builder.mixin(spaceClass, core.class.Class, activity.mixin.ActivityDoc, {}) builder.mixin(spaceClass, core.class.Class, workbench.mixin.SpaceView, { view: { @@ -497,7 +524,7 @@ export function createModel (builder: Builder, options = { addApplication: true activity.class.TxViewlet, core.space.Model, { - objectClass: notification.class.ChatMessage, + objectClass: chunter.class.ChatMessage, icon: chunter.icon.Chunter, txClass: core.class.TxCreateDoc, component: chunter.activity.TxCommentCreate, @@ -616,7 +643,7 @@ export function createModel (builder: Builder, options = { addApplication: true activity.class.TxViewlet, core.space.Model, { - objectClass: notification.class.ChatMessage, + objectClass: chunter.class.ChatMessage, icon: chunter.icon.Chunter, txClass: core.class.TxRemoveDoc, display: 'inline', @@ -672,7 +699,7 @@ export function createModel (builder: Builder, options = { addApplication: true chunter.ids.TxBacklinkRemove ) - builder.createDoc(notification.class.ActivityMessagesFilter, core.space.Model, { + builder.createDoc(activity.class.ActivityMessagesFilter, core.space.Model, { label: chunter.string.FilterBacklinks, filter: chunter.filter.BacklinksFilter }) @@ -758,44 +785,6 @@ export function createModel (builder: Builder, options = { addApplication: true chunter.ids.ChannelNotification ) - builder.createDoc( - notification.class.ActivityMessageExtension, - core.space.Model, - { - ofMessage: notification.class.DocUpdateMessage, - components: [ - { - kind: 'footer', - component: chunter.component.ReactionsPresenter - }, - { - kind: 'action', - component: chunter.component.ActivityMessageReactionsAction - } - ] - }, - chunter.ids.DocUpdateMessageExtension - ) - - builder.createDoc( - notification.class.ActivityMessageExtension, - core.space.Model, - { - ofMessage: notification.class.ChatMessage, - components: [ - { - kind: 'footer', - component: chunter.component.ReactionsPresenter - }, - { - kind: 'action', - component: chunter.component.ActivityMessageReactionsAction - } - ] - }, - chunter.ids.ChatMessageExtension - ) - builder.createDoc( notification.class.NotificationType, core.space.Model, @@ -814,52 +803,27 @@ export function createModel (builder: Builder, options = { addApplication: true ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: chunter.class.Backlink, action: 'create', component: chunter.component.BacklinkContent, - labelComponent: chunter.component.NotificationBacklinkLabel, + labelComponent: chunter.activity.BacklinkCreatedLabel, hideIfRemoved: true }, - chunter.ids.NotificationBacklinkCreated + chunter.ids.BacklinkCreatedActivityViewlet ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: chunter.class.Backlink, action: 'remove', hideIfRemoved: true }, - chunter.ids.NotificationBacklinkRemoved - ) - - builder.createDoc( - notification.class.DocUpdateMessageViewlet, - core.space.Model, - { - objectClass: chunter.class.Reaction, - action: 'create', - component: chunter.component.NotificationReactionCreated, - label: chunter.string.Reacted, - onlyWithParent: true, - hideIfRemoved: true - }, - chunter.ids.NotificationReactionCreated - ) - - builder.createDoc( - notification.class.DocUpdateMessageViewlet, - core.space.Model, - { - objectClass: chunter.class.Reaction, - action: 'remove', - hideIfRemoved: true - }, - chunter.ids.NotificationReactionRemoved + chunter.ids.BacklinkRemovedActivityViewlet ) createAction(builder, { @@ -874,6 +838,35 @@ export function createModel (builder: Builder, options = { addApplication: true mode: 'space' } }) + + builder.createDoc(activity.class.ActivityMessagesFilter, core.space.Model, { + label: chunter.string.Comments, + filter: chunter.filter.ChatMessagesFilter + }) + builder.mixin(chunter.class.ChatMessage, core.class.Class, activity.mixin.ActivityDoc, {}) + + builder.mixin(chunter.class.ChatMessage, core.class.Class, view.mixin.CollectionPresenter, { + presenter: chunter.component.ChatMessagesPresenter + }) + + builder.mixin(chunter.class.ChatMessage, core.class.Class, view.mixin.ObjectPresenter, { + presenter: chunter.component.ChatMessagePresenter + }) + + createAction( + builder, + { + action: chunter.actionImpl.DeleteChatMessage, + label: view.string.Delete, + icon: view.icon.Delete, + input: 'focus', + keyBinding: ['Backspace'], + category: chunter.category.Chunter, + target: chunter.class.ChatMessage, + context: { mode: ['context', 'browser'], group: 'edit' } + }, + chunter.action.DeleteChatMessage + ) } export default chunter diff --git a/models/chunter/src/migration.ts b/models/chunter/src/migration.ts index 7bd812ba5a..75db42c70a 100644 --- a/models/chunter/src/migration.ts +++ b/models/chunter/src/migration.ts @@ -21,7 +21,6 @@ import { tryMigrate } from '@hcengineering/model' import { chunterId } from '@hcengineering/chunter' -import notification from '@hcengineering/notification' import { DOMAIN_NOTIFICATION } from '@hcengineering/model-notification' import { DOMAIN_COMMENT } from './index' @@ -90,8 +89,8 @@ async function createBacklink (tx: TxOperations): Promise { } async function convertCommentsToChatMessages (client: MigrationClient): Promise { - await client.update(DOMAIN_COMMENT, { _class: chunter.class.Comment }, { _class: notification.class.ChatMessage }) - await client.move(DOMAIN_COMMENT, { _class: notification.class.ChatMessage }, DOMAIN_NOTIFICATION) + await client.update(DOMAIN_COMMENT, { _class: chunter.class.Comment }, { _class: chunter.class.ChatMessage }) + await client.move(DOMAIN_COMMENT, { _class: chunter.class.ChatMessage }, DOMAIN_NOTIFICATION) } export const chunterOperation: MigrateOperation = { diff --git a/models/chunter/src/plugin.ts b/models/chunter/src/plugin.ts index f873e2559c..d581285a74 100644 --- a/models/chunter/src/plugin.ts +++ b/models/chunter/src/plugin.ts @@ -13,16 +13,11 @@ // limitations under the License. // -import type { TxViewlet } from '@hcengineering/activity' +import type { ActivityMessage, DocUpdateMessageViewlet, TxViewlet } from '@hcengineering/activity' import { chunterId, type Channel } from '@hcengineering/chunter' import chunter from '@hcengineering/chunter-resources/src/plugin' import type { Doc, Ref, Space } from '@hcengineering/core' -import { - type ActivityMessage, - type ActivityMessageExtension, - type DocUpdateMessageViewlet, - type NotificationGroup -} from '@hcengineering/notification' +import { type NotificationGroup } from '@hcengineering/notification' import type { IntlString, Resource } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' import type { AnyComponent, Location } from '@hcengineering/ui/src/types' @@ -37,9 +32,6 @@ export default mergeIds(chunterId, chunter, { Threads: '' as AnyComponent, SavedMessages: '' as AnyComponent, ChunterBrowser: '' as AnyComponent, - ReactionsPresenter: '' as AnyComponent, - ReactionsAction: '' as AnyComponent, - ActivityMessageReactionsAction: '' as AnyComponent, BacklinkContent: '' as AnyComponent, BacklinkReference: '' as AnyComponent }, @@ -58,14 +50,14 @@ export default mergeIds(chunterId, chunter, { MarkCommentUnread: '' as ViewAction, ArchiveChannel: '' as ViewAction, UnarchiveChannel: '' as ViewAction, - ConvertDmToPrivateChannel: '' as ViewAction + ConvertDmToPrivateChannel: '' as ViewAction, + DeleteChatMessage: '' as ViewAction }, category: { Chunter: '' as Ref }, string: { ApplicationLabelChunter: '' as IntlString, - LeftComment: '' as IntlString, MentionedIn: '' as IntlString, Content: '' as IntlString, Comment: '' as IntlString, @@ -100,16 +92,13 @@ export default mergeIds(chunterId, chunter, { TxChatMessageCreate: '' as Ref, TxChatMessageRemove: '' as Ref, ChunterNotificationGroup: '' as Ref, - DocUpdateMessageExtension: '' as Ref, - ChatMessageExtension: '' as Ref, - NotificationBacklinkCreated: '' as Ref, - NotificationBacklinkRemoved: '' as Ref, - NotificationReactionCreated: '' as Ref, - NotificationReactionRemoved: '' as Ref + BacklinkCreatedActivityViewlet: '' as Ref, + BacklinkRemovedActivityViewlet: '' as Ref }, activity: { TxCommentCreate: '' as AnyComponent, - TxMessageCreate: '' as AnyComponent + TxMessageCreate: '' as AnyComponent, + BacklinkCreatedLabel: '' as AnyComponent }, space: { General: '' as Ref, @@ -121,6 +110,7 @@ export default mergeIds(chunterId, chunter, { GetFragment: '' as Resource<(doc: Doc, props: Record) => Promise> }, filter: { - BacklinksFilter: '' as Resource<(message: ActivityMessage, _class?: Ref) => boolean> + BacklinksFilter: '' as Resource<(message: ActivityMessage, _class?: Ref) => boolean>, + ChatMessagesFilter: '' as Resource<(message: ActivityMessage, _class?: Ref) => boolean> } }) diff --git a/models/contact/package.json b/models/contact/package.json index 5a82256894..35f18e920f 100644 --- a/models/contact/package.json +++ b/models/contact/package.json @@ -25,24 +25,25 @@ "prettier-plugin-svelte": "^3.1.0" }, "dependencies": { - "@hcengineering/model-core": "^0.6.0", - "@hcengineering/model-chunter": "^0.6.0", - "@hcengineering/model-workbench": "^0.6.1", - "@hcengineering/model-attachment": "^0.6.0", - "@hcengineering/model-notification": "^0.6.0", - "@hcengineering/model-view": "^0.6.0", - "@hcengineering/model-presentation": "^0.6.0", - "@hcengineering/model": "^0.6.7", - "@hcengineering/setting": "^0.6.11", - "@hcengineering/core": "^0.6.28", - "@hcengineering/ui": "^0.6.11", - "@hcengineering/platform": "^0.6.9", "@hcengineering/activity": "^0.6.0", + "@hcengineering/chunter": "^0.6.12", "@hcengineering/contact": "^0.6.20", - "@hcengineering/notification": "^0.6.16", "@hcengineering/contact-resources": "^0.6.0", + "@hcengineering/core": "^0.6.28", + "@hcengineering/model": "^0.6.7", + "@hcengineering/model-attachment": "^0.6.0", + "@hcengineering/model-chunter": "^0.6.0", + "@hcengineering/model-core": "^0.6.0", + "@hcengineering/model-notification": "^0.6.0", + "@hcengineering/model-presentation": "^0.6.0", + "@hcengineering/model-view": "^0.6.0", + "@hcengineering/model-workbench": "^0.6.1", + "@hcengineering/notification": "^0.6.16", + "@hcengineering/platform": "^0.6.9", + "@hcengineering/setting": "^0.6.11", + "@hcengineering/templates": "^0.6.7", + "@hcengineering/ui": "^0.6.11", "@hcengineering/view": "^0.6.9", - "cross-fetch": "^3.1.5", - "@hcengineering/templates": "^0.6.7" + "cross-fetch": "^3.1.5" } } diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index d5005475bf..4e76760f7d 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -112,7 +112,7 @@ export class TContact extends TDoc implements Contact { @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) attachments?: number - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments?: number @Prop(TypeString(), contact.string.Location) @@ -221,24 +221,37 @@ export function createModel (builder: Builder): void { TContactsTab ) - builder.mixin(contact.class.Contact, core.class.Class, notification.mixin.ActivityDoc, { - ignoreCollections: ['comments'] - }) - builder.mixin(contact.class.Person, core.class.Class, notification.mixin.ActivityDoc, { - ignoreCollections: ['comments'] - }) - builder.mixin(contact.mixin.Employee, core.class.Class, notification.mixin.ActivityDoc, { - ignoreCollections: ['comments'] - }) - builder.mixin(contact.class.Organization, core.class.Class, notification.mixin.ActivityDoc, { + builder.mixin(contact.class.Contact, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) - builder.mixin(contact.class.Person, core.class.Class, notification.mixin.NotificationObjectPreposition, { - preposition: contact.string.For + builder.mixin(contact.class.Person, core.class.Class, activity.mixin.ActivityDoc, { + preposition: contact.string.For, + ignoreCollections: ['comments'] }) - builder.mixin(contact.mixin.Employee, core.class.Class, notification.mixin.NotificationObjectPreposition, { - preposition: contact.string.For + + builder.mixin(contact.mixin.Employee, core.class.Class, activity.mixin.ActivityDoc, { + preposition: contact.string.For, + ignoreCollections: ['comments'] + }) + + builder.mixin(contact.class.Organization, core.class.Class, activity.mixin.ActivityDoc, { + ignoreCollections: ['comments'] + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: contact.class.Contact, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: contact.class.Person, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: contact.class.Organization, + components: { input: chunter.component.ChatMessageInput } }) builder.mixin(contact.mixin.Employee, core.class.Class, view.mixin.ObjectFactory, { @@ -329,12 +342,12 @@ export function createModel (builder: Builder): void { match: { 'operations.name': { $exists: true } } }) - builder.createDoc(notification.class.DocUpdateMessageViewlet, core.space.Model, { + builder.createDoc(activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: contact.class.Person, action: 'update', config: { name: { - presenter: contact.notification.NotificationNameChanged + presenter: contact.activity.NameChangedActivityMessage } } }) @@ -968,7 +981,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: contact.class.Person, @@ -978,7 +991,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: contact.mixin.Employee, @@ -988,7 +1001,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: contact.class.Organization, diff --git a/models/contact/src/plugin.ts b/models/contact/src/plugin.ts index 3cda3bff46..ead8c97e1e 100644 --- a/models/contact/src/plugin.ts +++ b/models/contact/src/plugin.ts @@ -18,18 +18,17 @@ import { contactId } from '@hcengineering/contact' import contact from '@hcengineering/contact-resources/src/plugin' import type { Client, Doc, Ref } from '@hcengineering/core' import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/model-presentation' -import { type ChatMessageViewlet, type NotificationGroup } from '@hcengineering/notification' +import { type NotificationGroup } from '@hcengineering/notification' import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' import { type TemplateFieldFunc } from '@hcengineering/templates' import type { AnyComponent } from '@hcengineering/ui/src/types' import { type Action, type ActionCategory, type ViewAction } from '@hcengineering/view' +import { type ChatMessageViewlet } from '@hcengineering/chunter' export default mergeIds(contactId, contact, { activity: { - TxNameChange: '' as AnyComponent - }, - notification: { - NotificationNameChanged: '' as AnyComponent + TxNameChange: '' as AnyComponent, + NameChangedActivityMessage: '' as AnyComponent }, component: { PersonPresenter: '' as AnyComponent, diff --git a/models/hr/package.json b/models/hr/package.json index d66814350c..d4090b56e3 100644 --- a/models/hr/package.json +++ b/models/hr/package.json @@ -25,20 +25,21 @@ "prettier-plugin-svelte": "^3.1.0" }, "dependencies": { - "@hcengineering/core": "^0.6.28", - "@hcengineering/model": "^0.6.7", - "@hcengineering/ui": "^0.6.11", "@hcengineering/contact": "^0.6.20", - "@hcengineering/platform": "^0.6.9", - "@hcengineering/model-core": "^0.6.0", - "@hcengineering/notification": "^0.6.16", - "@hcengineering/model-view": "^0.6.0", - "@hcengineering/model-workbench": "^0.6.1", - "@hcengineering/model-contact": "^0.6.1", - "@hcengineering/model-calendar": "^0.6.0", - "@hcengineering/model-attachment": "^0.6.0", + "@hcengineering/core": "^0.6.28", "@hcengineering/hr": "^0.6.12", "@hcengineering/hr-resources": "^0.6.0", + "@hcengineering/model": "^0.6.7", + "@hcengineering/model-attachment": "^0.6.0", + "@hcengineering/model-calendar": "^0.6.0", + "@hcengineering/model-chunter": "^0.6.0", + "@hcengineering/model-contact": "^0.6.1", + "@hcengineering/model-core": "^0.6.0", + "@hcengineering/model-view": "^0.6.0", + "@hcengineering/model-workbench": "^0.6.1", + "@hcengineering/notification": "^0.6.16", + "@hcengineering/platform": "^0.6.9", + "@hcengineering/ui": "^0.6.11", "@hcengineering/view": "^0.6.9" } } diff --git a/models/hr/src/index.ts b/models/hr/src/index.ts index 8cfc91717a..a3d934975f 100644 --- a/models/hr/src/index.ts +++ b/models/hr/src/index.ts @@ -59,6 +59,7 @@ import notification from '@hcengineering/notification' import { type Asset, type IntlString } from '@hcengineering/platform' import hr from './plugin' import { PaletteColorIndexes } from '@hcengineering/ui/src/colors' +import chunter from '@hcengineering/model-chunter' export { hrId } from '@hcengineering/hr' export { hrOperation } from './migration' @@ -83,7 +84,7 @@ export class TDepartment extends TSpace implements Department { @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) attachments?: number - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments?: number avatar?: string | null @@ -157,7 +158,7 @@ export class TRequest extends TAttachedDoc implements Request { @Hidden() type!: Ref - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments?: number @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) diff --git a/models/inventory/package.json b/models/inventory/package.json index 29a3e54648..a644a65cb6 100644 --- a/models/inventory/package.json +++ b/models/inventory/package.json @@ -25,20 +25,21 @@ "prettier-plugin-svelte": "^3.1.0" }, "dependencies": { + "@hcengineering/activity": "^0.6.0", + "@hcengineering/chunter": "^0.6.12", "@hcengineering/core": "^0.6.28", - "@hcengineering/model": "^0.6.7", - "@hcengineering/model-workbench": "^0.6.1", - "@hcengineering/model-attachment": "^0.6.0", - "@hcengineering/model-core": "^0.6.0", - "@hcengineering/ui": "^0.6.11", - "@hcengineering/platform": "^0.6.9", - "@hcengineering/notification": "^0.6.16", "@hcengineering/inventory": "^0.6.7", "@hcengineering/inventory-resources": "^0.6.0", - "@hcengineering/view": "^0.6.9", - "@hcengineering/setting": "^0.6.11", - "@hcengineering/workbench": "^0.6.9", + "@hcengineering/model": "^0.6.7", + "@hcengineering/model-attachment": "^0.6.0", + "@hcengineering/model-chunter": "^0.6.0", + "@hcengineering/model-core": "^0.6.0", "@hcengineering/model-view": "^0.6.0", - "@hcengineering/model-chunter": "^0.6.0" + "@hcengineering/model-workbench": "^0.6.1", + "@hcengineering/platform": "^0.6.9", + "@hcengineering/setting": "^0.6.11", + "@hcengineering/ui": "^0.6.11", + "@hcengineering/view": "^0.6.9", + "@hcengineering/workbench": "^0.6.9" } } diff --git a/models/inventory/src/index.ts b/models/inventory/src/index.ts index c355e96053..23c34e068e 100644 --- a/models/inventory/src/index.ts +++ b/models/inventory/src/index.ts @@ -22,8 +22,8 @@ import { createAction } from '@hcengineering/model-view' import workbench from '@hcengineering/model-workbench' import setting from '@hcengineering/setting' import view, { type Viewlet } from '@hcengineering/view' -import notification from '@hcengineering/notification' import chunter from '@hcengineering/model-chunter' +import activity from '@hcengineering/activity' import inventory from './plugin' export { inventoryId } from '@hcengineering/inventory' @@ -79,9 +79,24 @@ export class TVariant extends TAttachedDoc implements Variant { export function createModel (builder: Builder): void { builder.createModel(TCategory, TProduct, TVariant) - builder.mixin(inventory.class.Product, core.class.Class, notification.mixin.ActivityDoc, {}) - builder.mixin(inventory.class.Category, core.class.Class, notification.mixin.ActivityDoc, {}) - builder.mixin(inventory.class.Variant, core.class.Class, notification.mixin.ActivityDoc, {}) + builder.mixin(inventory.class.Product, core.class.Class, activity.mixin.ActivityDoc, {}) + builder.mixin(inventory.class.Category, core.class.Class, activity.mixin.ActivityDoc, {}) + builder.mixin(inventory.class.Variant, core.class.Class, activity.mixin.ActivityDoc, {}) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: inventory.class.Product, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: inventory.class.Category, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: inventory.class.Variant, + components: { input: chunter.component.ChatMessageInput } + }) builder.mixin(inventory.class.Category, core.class.Class, view.mixin.ObjectPresenter, { presenter: inventory.component.CategoryPresenter @@ -169,7 +184,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: inventory.class.Product, @@ -179,7 +194,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: inventory.class.Category, diff --git a/models/inventory/src/plugin.ts b/models/inventory/src/plugin.ts index b98b60615b..bc4cec433e 100644 --- a/models/inventory/src/plugin.ts +++ b/models/inventory/src/plugin.ts @@ -14,13 +14,13 @@ // limitations under the License. // +import { type ChatMessageViewlet } from '@hcengineering/chunter' import type { Ref } from '@hcengineering/core' import { inventoryId } from '@hcengineering/inventory' import inventory from '@hcengineering/inventory-resources/src/plugin' import { type IntlString, mergeIds } from '@hcengineering/platform' import type { AnyComponent } from '@hcengineering/ui/src/types' import { type Action, type ActionCategory, type ViewAction, type Viewlet } from '@hcengineering/view' -import { type ChatMessageViewlet } from '@hcengineering/notification' export default mergeIds(inventoryId, inventory, { action: { CreateSubcategory: '' as Ref diff --git a/models/lead/package.json b/models/lead/package.json index 2e0a04a66b..b9fbc8bab4 100644 --- a/models/lead/package.json +++ b/models/lead/package.json @@ -25,26 +25,28 @@ "prettier-plugin-svelte": "^3.1.0" }, "dependencies": { - "@hcengineering/core": "^0.6.28", - "@hcengineering/model": "^0.6.7", - "@hcengineering/ui": "^0.6.11", + "@hcengineering/activity": "^0.6.0", "@hcengineering/contact": "^0.6.20", - "@hcengineering/platform": "^0.6.9", + "@hcengineering/core": "^0.6.28", + "@hcengineering/lead": "^0.6.0", + "@hcengineering/chunter": "^0.6.12", + "@hcengineering/lead-resources": "^0.6.0", + "@hcengineering/model": "^0.6.7", + "@hcengineering/model-attachment": "^0.6.0", + "@hcengineering/model-chunter": "^0.6.0", + "@hcengineering/model-contact": "^0.6.1", "@hcengineering/model-core": "^0.6.0", + "@hcengineering/model-notification": "^0.6.0", + "@hcengineering/model-task": "^0.6.0", + "@hcengineering/model-tracker": "^0.6.0", "@hcengineering/model-view": "^0.6.0", "@hcengineering/model-workbench": "^0.6.1", - "@hcengineering/model-contact": "^0.6.1", - "@hcengineering/model-chunter": "^0.6.0", - "@hcengineering/model-attachment": "^0.6.0", - "@hcengineering/lead": "^0.6.0", - "@hcengineering/lead-resources": "^0.6.0", - "@hcengineering/setting": "^0.6.11", - "@hcengineering/view": "^0.6.9", - "@hcengineering/task": "^0.6.13", - "@hcengineering/model-notification": "^0.6.0", "@hcengineering/notification": "^0.6.16", - "@hcengineering/model-task": "^0.6.0", - "@hcengineering/workbench": "^0.6.9", - "@hcengineering/model-tracker": "^0.6.0" + "@hcengineering/platform": "^0.6.9", + "@hcengineering/setting": "^0.6.11", + "@hcengineering/task": "^0.6.13", + "@hcengineering/ui": "^0.6.11", + "@hcengineering/view": "^0.6.9", + "@hcengineering/workbench": "^0.6.9" } } diff --git a/models/lead/src/index.ts b/models/lead/src/index.ts index 032eead78a..f27cb85ed5 100644 --- a/models/lead/src/index.ts +++ b/models/lead/src/index.ts @@ -43,6 +43,8 @@ import workbench from '@hcengineering/model-workbench' import notification from '@hcengineering/notification' import setting from '@hcengineering/setting' import { type ViewOptionsModel } from '@hcengineering/view' +import activity from '@hcengineering/activity' + import lead from './plugin' export { leadId } from '@hcengineering/lead' @@ -59,7 +61,7 @@ export class TFunnel extends TProject implements Funnel { @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) attachments?: number - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments?: number } @@ -102,13 +104,25 @@ export function createModel (builder: Builder): void { builder.createModel(TFunnel, TLead, TCustomer) - builder.mixin(lead.class.Lead, core.class.Class, notification.mixin.ActivityDoc, { + builder.mixin(lead.class.Lead, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) - builder.mixin(lead.mixin.Customer, core.class.Class, notification.mixin.ActivityDoc, { + + builder.mixin(lead.mixin.Customer, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) - builder.mixin(lead.class.Funnel, core.class.Class, notification.mixin.ActivityDoc, {}) + + builder.mixin(lead.class.Funnel, core.class.Class, activity.mixin.ActivityDoc, {}) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: lead.class.Lead, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: lead.class.Funnel, + components: { input: chunter.component.ChatMessageInput } + }) builder.mixin(lead.class.Funnel, core.class.Class, workbench.mixin.SpaceView, { view: { @@ -518,7 +532,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: lead.class.Lead, diff --git a/models/lead/src/plugin.ts b/models/lead/src/plugin.ts index 3630538e04..49ce0b10f7 100644 --- a/models/lead/src/plugin.ts +++ b/models/lead/src/plugin.ts @@ -14,10 +14,11 @@ // limitations under the License. // +import { type ChatMessageViewlet } from '@hcengineering/chunter' import type { Ref } from '@hcengineering/core' import { type Funnel, leadId } from '@hcengineering/lead' import lead from '@hcengineering/lead-resources/src/plugin' -import { type ChatMessageViewlet, type NotificationGroup, type NotificationType } from '@hcengineering/notification' +import { type NotificationGroup, type NotificationType } from '@hcengineering/notification' import type { IntlString } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' import { type ProjectType } from '@hcengineering/task' diff --git a/models/notification/src/activityMessages.ts b/models/notification/src/activityMessages.ts deleted file mode 100644 index a4db0abd10..0000000000 --- a/models/notification/src/activityMessages.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { type Builder } from '@hcengineering/model' -import view, { createAction } from '@hcengineering/model-view' -import core from '@hcengineering/model-core' - -import notification from './plugin' - -export function buildActivityMessages (builder: Builder): void { - builder.mixin(notification.class.DocUpdateMessage, core.class.Class, notification.mixin.ActivityDoc, {}) - builder.mixin(notification.class.ChatMessage, core.class.Class, notification.mixin.ActivityDoc, {}) - - builder.mixin(notification.class.ChatMessage, core.class.Class, view.mixin.CollectionPresenter, { - presenter: notification.component.ChatMessagesPresenter - }) - - builder.mixin(notification.class.ChatMessage, core.class.Class, view.mixin.ObjectPresenter, { - presenter: notification.component.ChatMessagePresenter - }) - - builder.mixin(notification.class.DocUpdateMessage, core.class.Class, view.mixin.ObjectPresenter, { - presenter: notification.component.DocUpdateMessagePresenter - }) - - builder.createDoc( - notification.class.ActivityMessageExtension, - core.space.Model, - { - ofMessage: notification.class.DocUpdateMessage, - components: [ - { - kind: 'action', - component: notification.component.PinMessageAction - } - ] - }, - notification.ids.DocUpdateMessagePinExtension - ) - - builder.createDoc( - notification.class.ActivityMessageExtension, - core.space.Model, - { - ofMessage: notification.class.ChatMessage, - components: [ - { - kind: 'action', - component: notification.component.PinMessageAction - } - ] - }, - notification.ids.ChatMessagePinExtension - ) - - builder.createDoc( - notification.class.DocUpdateMessageViewlet, - core.space.Model, - { - objectClass: notification.mixin.Collaborators, - action: 'update', - icon: notification.icon.Notifications, - component: notification.activity.TxCollaboratorsChange, - label: notification.string.ChangeCollaborators - }, - notification.ids.NotificationCollaboratorsChanged - ) - - builder.mixin(notification.mixin.Collaborators, core.class.Class, notification.mixin.NotificationAttributePresenter, { - presenter: notification.component.NotificationCollaboratorsChanged - }) - - builder.createDoc(notification.class.ActivityMessagesFilter, core.space.Model, { - label: notification.string.Attributes, - filter: notification.filter.AttributesFilter - }) - - builder.createDoc(notification.class.ActivityMessagesFilter, core.space.Model, { - label: notification.string.Pinned, - filter: notification.filter.PinnedFilter - }) - - builder.createDoc(notification.class.ActivityMessagesFilter, core.space.Model, { - label: notification.string.Comments, - filter: notification.filter.ChatMessagesFilter - }) - - buildActions(builder) -} - -function buildActions (builder: Builder): void { - createAction( - builder, - { - action: notification.actionImpl.DeleteChatMessage, - label: view.string.Delete, - icon: view.icon.Delete, - input: 'focus', - keyBinding: ['Backspace'], - category: notification.category.Notification, - target: notification.class.ChatMessage, - context: { mode: ['context', 'browser'], group: 'edit' } - }, - notification.action.DeleteChatMessage - ) - - createAction( - builder, - { - action: notification.actionImpl.MarkAsReadInboxNotification, - label: notification.string.MarkAsRead, - icon: notification.icon.Notifications, - input: 'focus', - visibilityTester: notification.function.HasInboxNotifications, - category: notification.category.Notification, - target: notification.class.ActivityMessage, - context: { mode: 'context', application: notification.app.Notification, group: 'edit' } - }, - notification.action.MarkAsReadInboxNotification - ) - - createAction( - builder, - { - action: notification.actionImpl.MarkAsUnreadInboxNotification, - label: notification.string.MarkAsUnread, - icon: notification.icon.Track, - input: 'focus', - visibilityTester: notification.function.HasntInboxNotifications, - category: notification.category.Notification, - target: notification.class.ActivityMessage, - context: { mode: 'context', application: notification.app.Notification, group: 'edit' } - }, - notification.action.MarkAsUnreadInboxNotification - ) - - createAction( - builder, - { - action: notification.actionImpl.DeleteInboxNotification, - label: notification.string.Archive, - icon: view.icon.Archive, - input: 'focus', - keyBinding: ['Backspace'], - category: notification.category.Notification, - target: notification.class.ActivityMessage, - context: { mode: ['context', 'browser'], group: 'edit' } - }, - notification.action.DeleteInboxNotification - ) -} diff --git a/models/notification/src/index.ts b/models/notification/src/index.ts index 26a3f85439..7f10819853 100644 --- a/models/notification/src/index.ts +++ b/models/notification/src/index.ts @@ -14,7 +14,7 @@ // limitations under the License. // -import activity from '@hcengineering/activity' +import activity, { type ActivityMessage } from '@hcengineering/activity' import chunter from '@hcengineering/chunter' import { type Account, @@ -39,11 +39,9 @@ import { Mixin, Model, Prop, - TypeMarkup, TypeRef, TypeString, UX, - Collection as PropCollection, TypeBoolean, TypeDate } from '@hcengineering/model' @@ -52,16 +50,6 @@ import preference, { TPreference } from '@hcengineering/model-preference' import view, { createAction } from '@hcengineering/model-view' import workbench from '@hcengineering/model-workbench' import { - type ActivityMessage, - type ActivityMessageExtension, - type ActivityMessageExtensionKind, - type ChatMessage, - type ChatMessageViewlet, - type DocUpdateAction, - type DocAttributeUpdates, - type DocUpdateMessage, - type DocUpdateMessageViewlet, - type DocUpdateMessageViewletAttributesConfig, type DocUpdates, type DocUpdateTx, inboxId, @@ -69,7 +57,6 @@ import { type DocNotifyContext, type Notification, type NotificationGroup, - type NotificationObjectPresenter, type NotificationPreferencesGroup, type NotificationPreview, type NotificationProvider, @@ -77,19 +64,14 @@ import { type NotificationStatus, type NotificationTemplate, type NotificationType, - type ActivityMessagesFilter, - type ActivityDoc, - type NotificationObjectPreposition, - notificationId + notificationId, + type NotificationObjectPresenter } from '@hcengineering/notification' -import { type Asset, type IntlString, type Resource } from '@hcengineering/platform' +import { type Asset, type IntlString } from '@hcengineering/platform' import setting from '@hcengineering/setting' import { type AnyComponent } from '@hcengineering/ui/src/types' -import attachment from '@hcengineering/model-attachment' -import { type NotificationAttributePresenter } from '@hcengineering/view' import notification from './plugin' -import { buildActivityMessages } from './activityMessages' export { notificationId } from '@hcengineering/notification' export { notificationOperation } from './migration' @@ -174,21 +156,6 @@ export class TNotificationPreview extends TClass implements NotificationPreview presenter!: AnyComponent } -@Mixin(notification.mixin.ActivityDoc, core.class.Class) -export class TActivityDoc extends TClass implements ActivityDoc { - ignoreCollections?: string[] -} - -@Mixin(notification.mixin.NotificationObjectPreposition, core.class.Class) -export class TNotificationObjectPreposition extends TClass implements NotificationObjectPreposition { - preposition!: IntlString -} - -@Mixin(notification.mixin.NotificationAttributePresenter, core.class.Class) -export class TNotificationAttributePresenter extends TClass implements NotificationAttributePresenter { - presenter!: AnyComponent -} - @Model(notification.class.DocUpdates, core.class.Doc, DOMAIN_NOTIFICATION) export class TDocUpdates extends TDoc implements DocUpdates { @Index(IndexKind.Indexed) @@ -232,58 +199,13 @@ export class TDocNotifyContext extends TDoc implements DocNotifyContext { lastUpdateTimestamp?: Timestamp } -@Model(notification.class.ActivityMessage, core.class.AttachedDoc, DOMAIN_NOTIFICATION) -export class TActivityMessage extends TAttachedDoc implements ActivityMessage { - @Prop(TypeBoolean(), notification.string.Pinned) - @Index(IndexKind.Indexed) - isPinned?: boolean - - @Prop(PropCollection(chunter.class.Reaction), chunter.string.Reactions) - reactions?: number -} - -@Model(notification.class.DocUpdateMessage, notification.class.ActivityMessage, DOMAIN_NOTIFICATION) -export class TDocUpdateMessage extends TActivityMessage implements DocUpdateMessage { - @Prop(TypeRef(core.class.Doc), core.string.Object) - @Index(IndexKind.Indexed) - objectId!: Ref - - @Prop(TypeRef(core.class.Class), core.string.Class) - @Index(IndexKind.Indexed) - objectClass!: Ref> - - @Prop(TypeRef(core.class.TxCUD), core.string.Object) - @Index(IndexKind.Indexed) - txId!: Ref> - - action!: DocUpdateAction - updateCollection?: string - attributeUpdates?: DocAttributeUpdates -} - -@Model(notification.class.ChatMessage, notification.class.ActivityMessage, DOMAIN_NOTIFICATION) -export class TChatMessage extends TActivityMessage implements ChatMessage { - @Prop(TypeMarkup(), chunter.string.Message) - @Index(IndexKind.FullText) - message!: string - - @Prop(PropCollection(attachment.class.Attachment), attachment.string.Attachments, { - shortLabel: attachment.string.Files - }) - attachments?: number - - @Prop(TypeBoolean(), core.string.Boolean) - @Index(IndexKind.Indexed) - isEdited?: boolean -} - @Model(notification.class.InboxNotification, core.class.Doc, DOMAIN_NOTIFICATION) export class TInboxNotification extends TDoc implements InboxNotification { - @Prop(TypeRef(notification.class.ActivityMessage), core.string.AttachedTo) + @Prop(TypeRef(activity.class.ActivityMessage), core.string.AttachedTo) @Index(IndexKind.Indexed) attachedTo!: Ref - @Prop(TypeRef(notification.class.ActivityMessage), core.string.AttachedToClass) + @Prop(TypeRef(activity.class.ActivityMessage), core.string.AttachedToClass) @Index(IndexKind.Indexed) attachedToClass!: Ref> @@ -300,54 +222,6 @@ export class TInboxNotification extends TDoc implements InboxNotification { isViewed!: boolean } -@Model(notification.class.DocUpdateMessageViewlet, core.class.Doc, DOMAIN_MODEL) -export class TDocUpdateMessageViewlet extends TDoc implements DocUpdateMessageViewlet { - @Prop(TypeRef(core.class.Doc), core.string.Class) - @Index(IndexKind.Indexed) - objectClass!: Ref> - - @Prop(TypeString(), core.string.String) - @Index(IndexKind.Indexed) - action!: DocUpdateAction - - label?: IntlString - labelComponent?: AnyComponent - - valueAttr?: string - - icon?: Asset - component?: AnyComponent - config?: DocUpdateMessageViewletAttributesConfig - hideIfRemoved?: boolean - onlyWithParent?: boolean -} - -@Model(notification.class.ChatMessageViewlet, core.class.Doc, DOMAIN_MODEL) -export class TChatMessageViewlet extends TDoc implements ChatMessageViewlet { - @Prop(TypeRef(core.class.Doc), core.string.Class) - @Index(IndexKind.Indexed) - objectClass!: Ref> - - label?: IntlString - hidden?: boolean - onlyWithParent?: boolean -} - -@Model(notification.class.ActivityMessageExtension, core.class.Doc, DOMAIN_MODEL) -export class TActivityMessageExtension extends TDoc implements ActivityMessageExtension { - @Prop(TypeRef(notification.class.ActivityMessage), core.string.Class) - @Index(IndexKind.Indexed) - ofMessage!: Ref> - - components!: { kind: ActivityMessageExtensionKind, component: AnyComponent }[] -} - -@Model(notification.class.ActivityMessagesFilter, core.class.Doc, DOMAIN_MODEL) -export class TActivityMessagesFilter extends TDoc implements ActivityMessagesFilter { - label!: IntlString - filter!: Resource<(message: ActivityMessage, _class?: Ref) => boolean> -} - export function createModel (builder: Builder): void { builder.createModel( TNotification, @@ -362,17 +236,7 @@ export function createModel (builder: Builder): void { TNotificationObjectPresenter, TNotificationPreview, TDocNotifyContext, - TDocUpdateMessage, - TChatMessage, - TActivityMessage, - TInboxNotification, - TDocUpdateMessageViewlet, - TActivityMessageExtension, - TChatMessageViewlet, - TActivityMessagesFilter, - TActivityDoc, - TNotificationObjectPreposition, - TNotificationAttributePresenter + TInboxNotification ) // Temporarily disabled, we should think about it @@ -449,21 +313,21 @@ export function createModel (builder: Builder): void { { id: 'all', component: notification.component.NewInbox, - icon: notification.icon.Activity, - label: notification.string.AllActivity, + icon: activity.icon.Activity, + label: activity.string.AllActivity, componentProps: { type: 'all', - label: notification.string.AllActivity + label: activity.string.AllActivity } }, { id: 'reactions', component: notification.component.NewInbox, - icon: notification.icon.Emoji, - label: notification.string.Reactions, + icon: activity.icon.Emoji, + label: activity.string.Reactions, componentProps: { - _class: chunter.class.Reaction, - label: notification.string.Reactions + _class: activity.class.Reaction, + label: activity.string.Reactions } } ] @@ -597,7 +461,68 @@ export function createModel (builder: Builder): void { notification.ids.TxDmCreation ) - buildActivityMessages(builder) + builder.createDoc( + activity.class.DocUpdateMessageViewlet, + core.space.Model, + { + objectClass: notification.mixin.Collaborators, + action: 'update', + icon: notification.icon.Notifications, + component: notification.activity.TxCollaboratorsChange, + label: notification.string.ChangeCollaborators + }, + notification.ids.NotificationCollaboratorsChanged + ) + + builder.mixin(notification.mixin.Collaborators, core.class.Class, view.mixin.ActivityAttributePresenter, { + presenter: notification.component.NotificationCollaboratorsChanged + }) + + createAction( + builder, + { + action: notification.actionImpl.MarkAsReadInboxNotification, + label: notification.string.MarkAsRead, + icon: notification.icon.Notifications, + input: 'focus', + visibilityTester: notification.function.HasMarkAsReadAction, + category: notification.category.Notification, + target: activity.class.ActivityMessage, + context: { mode: 'context', application: notification.app.Notification, group: 'edit' } + }, + notification.action.MarkAsReadInboxNotification + ) + + createAction( + builder, + { + action: notification.actionImpl.MarkAsUnreadInboxNotification, + label: notification.string.MarkAsUnread, + icon: notification.icon.Track, + input: 'focus', + visibilityTester: notification.function.HasMarkAsUnreadAction, + category: notification.category.Notification, + target: activity.class.ActivityMessage, + context: { mode: 'context', application: notification.app.Notification, group: 'edit' } + }, + notification.action.MarkAsUnreadInboxNotification + ) + + createAction( + builder, + { + action: notification.actionImpl.DeleteInboxNotification, + label: notification.string.Archive, + icon: view.icon.Archive, + input: 'focus', + keyBinding: ['Backspace'], + category: notification.category.Notification, + visibilityTester: notification.function.HasDeleteNotificationAction, + target: activity.class.ActivityMessage, + context: { mode: ['context', 'browser'], group: 'edit' } + }, + notification.action.DeleteInboxNotification + ) } export function generateClassNotificationTypes ( diff --git a/models/notification/src/plugin.ts b/models/notification/src/plugin.ts index 37dcd9e6b0..ccee946854 100644 --- a/models/notification/src/plugin.ts +++ b/models/notification/src/plugin.ts @@ -15,16 +15,12 @@ // import { type Doc, type Ref } from '@hcengineering/core' -import notification, { - type ActivityMessageExtension, - type DocUpdateMessageViewlet, - notificationId -} from '@hcengineering/notification' +import notification, { notificationId } from '@hcengineering/notification' import { type IntlString, type Resource, mergeIds } from '@hcengineering/platform' 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 TxViewlet } from '@hcengineering/activity' +import { type DocUpdateMessageViewlet, type TxViewlet } from '@hcengineering/activity' export default mergeIds(notificationId, notification, { string: { @@ -35,11 +31,7 @@ export default mergeIds(notificationId, notification, { Archive: '' as IntlString, MarkAsUnread: '' as IntlString, MarkAsRead: '' as IntlString, - ChangeCollaborators: '' as IntlString, - AllActivity: '' as IntlString, - Threads: '' as IntlString, - Mentions: '' as IntlString, - Reactions: '' as IntlString + ChangeCollaborators: '' as IntlString }, app: { Notification: '' as Ref, @@ -51,9 +43,7 @@ export default mergeIds(notificationId, notification, { ids: { TxCollaboratorsChange: '' as Ref, TxDmCreation: '' as Ref, - NotificationCollaboratorsChanged: '' as Ref, - DocUpdateMessagePinExtension: '' as Ref, - ChatMessagePinExtension: '' as Ref + NotificationCollaboratorsChanged: '' as Ref }, component: { NotificationSettings: '' as AnyComponent, @@ -64,8 +54,9 @@ export default mergeIds(notificationId, notification, { }, function: { HasntNotifications: '' as Resource<(doc?: Doc | Doc[]) => Promise>, - HasntInboxNotifications: '' as Resource<(doc?: Doc | Doc[]) => Promise>, - HasInboxNotifications: '' as Resource<(doc?: Doc | Doc[]) => Promise> + HasMarkAsUnreadAction: '' as Resource<(doc?: Doc | Doc[]) => Promise>, + HasMarkAsReadAction: '' as Resource<(doc?: Doc | Doc[]) => Promise>, + HasDeleteNotificationAction: '' as Resource<(doc?: Doc | Doc[]) => Promise> }, category: { Notification: '' as Ref @@ -82,7 +73,6 @@ export default mergeIds(notificationId, notification, { MarkAsUnread: '' as ViewAction, MarkAsUnreadInboxNotification: '' as ViewAction, MarkAsReadInboxNotification: '' as ViewAction, - DeleteInboxNotification: '' as ViewAction, - DeleteChatMessage: '' as ViewAction + DeleteInboxNotification: '' as ViewAction } }) diff --git a/models/recruit/package.json b/models/recruit/package.json index 76b224dce0..76e40529cc 100644 --- a/models/recruit/package.json +++ b/models/recruit/package.json @@ -26,6 +26,8 @@ }, "dependencies": { "@anticrm/skillset": "^0.6.0", + "@hcengineering/activity": "^0.6.0", + "@hcengineering/chunter": "^0.6.12", "@hcengineering/contact": "^0.6.20", "@hcengineering/core": "^0.6.28", "@hcengineering/model": "^0.6.7", diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index a6a42a3f32..8e3fe4a357 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -56,6 +56,7 @@ import { } from '@hcengineering/recruit' import setting from '@hcengineering/setting' import { type KeyBinding, type ViewOptionModel, type ViewOptionsModel } from '@hcengineering/view' +import activity from '@hcengineering/activity' import recruit from './plugin' import { createReviewModel, reviewTableConfig, reviewTableOptions } from './review' @@ -85,7 +86,7 @@ export class TVacancy extends TProject implements Vacancy { @Prop(TypeRef(contact.class.Organization), recruit.string.Company, { icon: contact.icon.Company }) company?: Ref - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments?: number @Prop(TypeString(), recruit.string.Vacancy) @@ -197,18 +198,33 @@ export class TApplicantMatch extends TAttachedDoc implements ApplicantMatch { export function createModel (builder: Builder): void { builder.createModel(TVacancy, TCandidates, TCandidate, TApplicant, TReview, TOpinion, TVacancyList, TApplicantMatch) - builder.mixin(recruit.class.Vacancy, core.class.Class, notification.mixin.ActivityDoc, { + builder.mixin(recruit.class.Vacancy, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) - builder.mixin(recruit.class.Applicant, core.class.Class, notification.mixin.ActivityDoc, { + builder.mixin(recruit.class.Applicant, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) - builder.mixin(recruit.class.Review, core.class.Class, notification.mixin.ActivityDoc, {}) + builder.mixin(recruit.class.Review, core.class.Class, activity.mixin.ActivityDoc, {}) - builder.mixin(recruit.mixin.Candidate, core.class.Class, notification.mixin.ActivityDoc, { + builder.mixin(recruit.mixin.Candidate, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: recruit.class.Vacancy, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: recruit.class.Applicant, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: recruit.class.Review, + components: { input: chunter.component.ChatMessageInput } + }) + builder.mixin(recruit.class.Vacancy, core.class.Class, workbench.mixin.SpaceView, { view: { class: recruit.class.Applicant, @@ -1585,7 +1601,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: recruit.class.Vacancy, @@ -1595,7 +1611,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: recruit.class.Applicant, @@ -1605,7 +1621,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: recruit.class.Review, @@ -1625,7 +1641,7 @@ export function createModel (builder: Builder): void { propagate: [recruit.class.Applicant], propagateClasses: [ tags.class.TagReference, - notification.class.ChatMessage, + chunter.class.ChatMessage, attachment.class.Attachment, contact.class.Channel ] @@ -1679,7 +1695,7 @@ export function createModel (builder: Builder): void { }) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: recruit.class.Applicant, @@ -1690,7 +1706,7 @@ export function createModel (builder: Builder): void { } } }, - recruit.ids.NotificationApplicantUpdated + recruit.ids.ApplicantUpdatedActivityViewlet ) createAction( diff --git a/models/recruit/src/plugin.ts b/models/recruit/src/plugin.ts index c37ae8f61f..94791c3762 100644 --- a/models/recruit/src/plugin.ts +++ b/models/recruit/src/plugin.ts @@ -14,12 +14,7 @@ // import type { Client, Doc, Ref } from '@hcengineering/core' -import { - type ChatMessageViewlet, - type DocUpdateMessageViewlet, - type NotificationGroup, - type NotificationType -} from '@hcengineering/notification' +import { type NotificationGroup, type NotificationType } from '@hcengineering/notification' import type { IntlString, Resource, Status } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' import { recruitId } from '@hcengineering/recruit' @@ -27,6 +22,8 @@ import recruit from '@hcengineering/recruit-resources/src/plugin' import { type ProjectType } from '@hcengineering/task' import type { AnyComponent, Location } from '@hcengineering/ui/src/types' import type { Action, ActionCategory, ViewAction, ViewQueryAction, Viewlet } from '@hcengineering/view' +import { type DocUpdateMessageViewlet } from '@hcengineering/activity' +import { type ChatMessageViewlet } from '@hcengineering/chunter' export default mergeIds(recruitId, recruit, { action: { @@ -88,7 +85,7 @@ export default mergeIds(recruitId, recruit, { AssigneeNotification: '' as Ref, ApplicationCreateNotification: '' as Ref, ReviewCreateNotification: '' as Ref, - NotificationApplicantUpdated: '' as Ref, + ApplicantUpdatedActivityViewlet: '' as Ref, ApplicantChatMessageViewlet: '' as Ref, VacancyChatMessageViewlet: '' as Ref, ReviewChatMessageViewlet: '' as Ref diff --git a/models/recruit/src/review-model.ts b/models/recruit/src/review-model.ts index b640315f44..5941c21158 100644 --- a/models/recruit/src/review-model.ts +++ b/models/recruit/src/review-model.ts @@ -7,8 +7,9 @@ import contact from '@hcengineering/model-contact' import core, { TAttachedDoc } from '@hcengineering/model-core' import task from '@hcengineering/model-task' import { type Applicant, type Candidate, type Opinion, type Review } from '@hcengineering/recruit' +import chunter from '@hcengineering/model-chunter' + import recruit from './plugin' -import notification from '@hcengineering/notification' @Model(recruit.class.Review, calendar.class.Event) @UX(recruit.string.Review, recruit.icon.Review, 'RVE', 'number') @@ -47,7 +48,7 @@ export class TOpinion extends TAttachedDoc implements Opinion { @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) attachments?: number - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments?: number @Prop(TypeMarkup(), recruit.string.Description) diff --git a/models/request/src/index.ts b/models/request/src/index.ts index 1e7fd89d3f..61bccac5c6 100644 --- a/models/request/src/index.ts +++ b/models/request/src/index.ts @@ -30,7 +30,7 @@ import { TypeString, UX } from '@hcengineering/model' -import { TComment } from '@hcengineering/model-chunter' +import chunter, { TComment } from '@hcengineering/model-chunter' import core, { TAttachedDoc, TClass } from '@hcengineering/model-core' import { generateClassNotificationTypes } from '@hcengineering/model-notification' import view from '@hcengineering/model-view' @@ -72,11 +72,11 @@ export class TRequest extends TAttachedDoc implements Request { @ReadOnly() rejected?: Ref - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments?: number } -@Mixin(request.mixin.RequestDecisionComment, notification.class.ChatMessage) +@Mixin(request.mixin.RequestDecisionComment, chunter.class.ChatMessage) export class TRequestDecisionComment extends TComment implements RequestDecisionComment {} @Mixin(request.mixin.RequestPresenter, core.class.Class) diff --git a/models/server-activity/.eslintrc.js b/models/server-activity/.eslintrc.js new file mode 100644 index 0000000000..c1cf82cba0 --- /dev/null +++ b/models/server-activity/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@hcengineering/platform-rig/profiles/model/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/models/server-activity/.npmignore b/models/server-activity/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/models/server-activity/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/models/server-activity/config/rig.json b/models/server-activity/config/rig.json new file mode 100644 index 0000000000..2f6be36605 --- /dev/null +++ b/models/server-activity/config/rig.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + "rigPackageName": "@hcengineering/platform-rig", + "rigProfile": "model" +} diff --git a/models/server-activity/package.json b/models/server-activity/package.json new file mode 100644 index 0000000000..b113d47b49 --- /dev/null +++ b/models/server-activity/package.json @@ -0,0 +1,36 @@ +{ + "name": "@hcengineering/model-server-activity", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "tsc", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "format src" + }, + "template": "@hcengineering/model-package", + "devDependencies": { + "@hcengineering/platform-rig": "^0.6.0", + "@typescript-eslint/eslint-plugin": "^6.11.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-n": "^15.4.0", + "eslint": "^8.54.0", + "@typescript-eslint/parser": "^6.11.0", + "eslint-config-standard-with-typescript": "^40.0.0", + "prettier": "^3.1.0", + "prettier-plugin-svelte": "^3.1.0" + }, + "dependencies": { + "@hcengineering/activity": "^0.6.0", + "@hcengineering/core": "^0.6.28", + "@hcengineering/model": "^0.6.7", + "@hcengineering/platform": "^0.6.9", + "@hcengineering/server-activity": "^0.6.0", + "@hcengineering/server-activity-resources": "^0.6.0", + "@hcengineering/server-core": "^0.6.1" + } +} diff --git a/models/server-activity/src/index.ts b/models/server-activity/src/index.ts new file mode 100644 index 0000000000..ca7a52f492 --- /dev/null +++ b/models/server-activity/src/index.ts @@ -0,0 +1,38 @@ +// +// Copyright © 2023 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { type Builder } from '@hcengineering/model' +import serverCore from '@hcengineering/server-core' +import core from '@hcengineering/core/lib/component' +import serverActivity from '@hcengineering/server-activity' + +export { activityServerOperation } from './migration' +export { serverActivityId } from '@hcengineering/server-activity' + +export function createModel (builder: Builder): void { + // NOTE: temporarily disabled + // builder.createDoc(serverCore.class.Trigger, core.space.Model, { + // trigger: serverNotification.trigger.OnReactionChanged, + // txMatch: { + // collection: 'reactions', + // objectClass: activity.class.ActivityMessage, + // _class: core.class.TxCollectionCUD + // } + // }) + + builder.createDoc(serverCore.class.Trigger, core.space.Model, { + trigger: serverActivity.trigger.ActivityMessagesHandler + }) +} diff --git a/models/server-notification/src/migration.ts b/models/server-activity/src/migration.ts similarity index 83% rename from models/server-notification/src/migration.ts rename to models/server-activity/src/migration.ts index 907e132002..563a5ed276 100644 --- a/models/server-notification/src/migration.ts +++ b/models/server-activity/src/migration.ts @@ -14,25 +14,30 @@ // import core, { - SortingOrder, - TxFactory, - toFindResult, - toIdMap, type AttachedDoc, type Class, type Doc, type Ref, type TxCUD, type TxCollectionCUD, - type TxCreateDoc, - TxProcessor + TxProcessor, + toIdMap, + SortingOrder, + TxFactory, + toFindResult, + type TxCreateDoc } from '@hcengineering/core' -import { type MigrateOperation, type MigrationClient, type MigrationIterator, tryMigrate } from '@hcengineering/model' -import notification, { type DocUpdateMessage } from '@hcengineering/notification' -import { getAllObjectTransactions, type DocObjectCache, serverNotificationId } from '@hcengineering/server-notification' -import { generateDocUpdateMessages, type NotificationControl } from '@hcengineering/server-notification-resources' +import activity, { type DocUpdateMessage } from '@hcengineering/activity' +import { tryMigrate, type MigrateOperation, type MigrationClient, type MigrationIterator } from '@hcengineering/model' +import { + type ActivityControl, + type DocObjectCache, + getAllObjectTransactions, + serverActivityId +} from '@hcengineering/server-activity' +import { generateDocUpdateMessages } from '@hcengineering/server-activity-resources' -function getNotificationControl (client: MigrationClient): NotificationControl { +function getActivityControl (client: MigrationClient): ActivityControl { const txFactory = new TxFactory(core.account.System, false) return { @@ -46,7 +51,7 @@ function getNotificationControl (client: MigrationClient): NotificationControl { async function generateDocUpdateMessageByTx ( tx: TxCUD, - control: NotificationControl, + control: ActivityControl, client: MigrationClient, objectCache?: DocObjectCache ): Promise { @@ -70,14 +75,14 @@ async function generateDocUpdateMessageByTx ( } async function createDocUpdateMessages (client: MigrationClient): Promise { - const activityDocs = await client.model.findAll(notification.mixin.ActivityDoc, { - _id: { $nin: [notification.class.DocUpdateMessage, notification.class.ChatMessage] } - }) - const activityDocClasses = activityDocs.map(({ _id }) => _id) + const activityDocs = await client.model.findAll(activity.mixin.ActivityDoc, {}) + const activityDocClasses = activityDocs + .map(({ _id }) => _id) + .filter((_class) => !client.hierarchy.isDerived(_class, activity.class.ActivityMessage)) - const notificationControl = getNotificationControl(client) + const notificationControl = getActivityControl(client) - const txClient: Pick = { + const txClient: Pick = { hierarchy: notificationControl.hierarchy, findAll: notificationControl.findAll } @@ -197,11 +202,11 @@ async function createDocUpdateMessages (client: MigrationClient): Promise console.log('process-finished', processed) } -export const notificationServerOperation: MigrateOperation = { +export const activityServerOperation: MigrateOperation = { async migrate (client: MigrationClient): Promise { - await tryMigrate(client, serverNotificationId, [ + await tryMigrate(client, serverActivityId, [ { - state: 'notifications', + state: 'activity-messages', func: createDocUpdateMessages } ]) diff --git a/models/server-activity/tsconfig.json b/models/server-activity/tsconfig.json new file mode 100644 index 0000000000..cce8988c63 --- /dev/null +++ b/models/server-activity/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./node_modules/@hcengineering/platform-rig/profiles/model/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + "tsBuildInfoFile": ".build/build.tsbuildinfo" + } +} \ No newline at end of file diff --git a/models/server-chunter/src/index.ts b/models/server-chunter/src/index.ts index b5d14d09d0..299a747d70 100644 --- a/models/server-chunter/src/index.ts +++ b/models/server-chunter/src/index.ts @@ -33,7 +33,7 @@ export function createModel (builder: Builder): void { }) builder.mixin, ObjectDDParticipant>( - notification.class.ChatMessage, + chunter.class.ChatMessage, core.class.Class, serverCore.mixin.ObjectDDParticipant, { diff --git a/models/server-notification/package.json b/models/server-notification/package.json index 56ea5b141d..3e2a0d2c9d 100644 --- a/models/server-notification/package.json +++ b/models/server-notification/package.json @@ -25,14 +25,15 @@ "prettier-plugin-svelte": "^3.1.0" }, "dependencies": { + "@hcengineering/activity": "^0.6.0", "@hcengineering/core": "^0.6.28", "@hcengineering/model": "^0.6.7", + "@hcengineering/model-chunter": "^0.6.0", "@hcengineering/model-core": "^0.6.0", "@hcengineering/model-notification": "^0.6.0", "@hcengineering/notification": "^0.6.16", "@hcengineering/platform": "^0.6.9", "@hcengineering/server-core": "^0.6.1", - "@hcengineering/server-notification": "^0.6.1", - "@hcengineering/server-notification-resources": "^0.6.0" + "@hcengineering/server-notification": "^0.6.1" } } diff --git a/models/server-notification/src/index.ts b/models/server-notification/src/index.ts index 509b476525..8390902b69 100644 --- a/models/server-notification/src/index.ts +++ b/models/server-notification/src/index.ts @@ -30,9 +30,9 @@ import serverNotification, { type TypeMatch, type NotificationContentProvider } from '@hcengineering/server-notification' +import chunter from '@hcengineering/model-chunter' export { serverNotificationId } from '@hcengineering/server-notification' -export { notificationServerOperation } from './migration' @Mixin(serverNotification.mixin.HTMLPresenter, core.class.Class) export class THTMLPresenter extends TClass implements HTMLPresenter { @@ -63,16 +63,6 @@ export function createModel (builder: Builder): void { trigger: serverNotification.trigger.OnBacklinkCreate }) - // NOTE: temporarily disabled - // builder.createDoc(serverCore.class.Trigger, core.space.Model, { - // trigger: serverNotification.trigger.OnReactionChanged, - // txMatch: { - // collection: 'reactions', - // objectClass: notification.class.ActivityMessage, - // _class: core.class.TxCollectionCUD - // } - // }) - builder.createDoc(serverCore.class.Trigger, core.space.Model, { trigger: serverNotification.trigger.NotificationMessagesHandler }) @@ -80,7 +70,7 @@ export function createModel (builder: Builder): void { builder.createDoc(serverCore.class.Trigger, core.space.Model, { trigger: serverNotification.trigger.OnChatMessageSent, txMatch: { - objectClass: notification.class.ChatMessage + objectClass: chunter.class.ChatMessage } }) diff --git a/models/server-openai/package.json b/models/server-openai/package.json index 9296ed6fb2..1f2bb6cbb1 100644 --- a/models/server-openai/package.json +++ b/models/server-openai/package.json @@ -27,9 +27,9 @@ "dependencies": { "@hcengineering/core": "^0.6.28", "@hcengineering/model": "^0.6.7", + "@hcengineering/model-chunter": "^0.6.0", "@hcengineering/model-core": "^0.6.0", "@hcengineering/model-recruit": "^0.6.0", - "@hcengineering/notification": "^0.6.16", "@hcengineering/openai": "^0.6.0", "@hcengineering/platform": "^0.6.9", "@hcengineering/server-core": "^0.6.1" diff --git a/models/server-openai/src/index.ts b/models/server-openai/src/index.ts index be700f43ac..7a08959f13 100644 --- a/models/server-openai/src/index.ts +++ b/models/server-openai/src/index.ts @@ -23,7 +23,7 @@ import openai, { type OpenAIConfiguration } from '@hcengineering/openai/src/plug import serverCore from '@hcengineering/server-core' import recruit from '@hcengineering/model-recruit' -import notification from '@hcengineering/notification' +import chunter from '@hcengineering/model-chunter' export { openAIId } from '@hcengineering/openai/src/plugin' @@ -49,7 +49,7 @@ export function createModel (builder: Builder): void { builder.createDoc(serverCore.class.Trigger, core.space.Model, { trigger: openai.trigger.AsyncOnGPTRequest, txMatch: { - objectClass: { $in: [notification.class.ChatMessage, recruit.class.ApplicantMatch] }, + objectClass: { $in: [chunter.class.ChatMessage, recruit.class.ApplicantMatch] }, _class: core.class.TxCreateDoc } }) diff --git a/models/setting/src/index.ts b/models/setting/src/index.ts index 6f14c78fb2..f16cbfe21d 100644 --- a/models/setting/src/index.ts +++ b/models/setting/src/index.ts @@ -329,7 +329,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: setting.class.Integration, @@ -338,7 +338,7 @@ export function createModel (builder: Builder): void { action: 'update', hideIfRemoved: true }, - setting.ids.UpdateIntegrationNotificationViewlet + setting.ids.UpdateIntegrationActivityViewlet ) builder.mixin(core.class.TypeString, core.class.Class, view.mixin.ObjectEditor, { diff --git a/models/setting/src/plugin.ts b/models/setting/src/plugin.ts index 41729dc301..ccaa9cb339 100644 --- a/models/setting/src/plugin.ts +++ b/models/setting/src/plugin.ts @@ -13,7 +13,7 @@ // limitations under the License. // -import type { TxViewlet } from '@hcengineering/activity' +import type { DocUpdateMessageViewlet, TxViewlet } 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' @@ -21,11 +21,7 @@ import setting from '@hcengineering/setting-resources/src/plugin' import { type AnyComponent } from '@hcengineering/ui/src/types' import { type Action, type ActionCategory, type ViewAction } from '@hcengineering/view' import { type TemplateFieldFunc } from '@hcengineering/templates' -import { - type DocUpdateMessageViewlet, - type NotificationGroup, - type NotificationType -} from '@hcengineering/notification' +import { type NotificationGroup, type NotificationType } from '@hcengineering/notification' export default mergeIds(settingId, setting, { activity: { @@ -37,7 +33,7 @@ export default mergeIds(settingId, setting, { Configure: '' as Ref, SettingNotificationGroup: '' as Ref, IntegrationDisabledNotification: '' as Ref, - UpdateIntegrationNotificationViewlet: '' as Ref + UpdateIntegrationActivityViewlet: '' as Ref }, component: { EnumSetting: '' as AnyComponent, diff --git a/models/task/package.json b/models/task/package.json index 038f029eae..cddd74705b 100644 --- a/models/task/package.json +++ b/models/task/package.json @@ -29,13 +29,13 @@ "@hcengineering/core": "^0.6.28", "@hcengineering/model": "^0.6.7", "@hcengineering/model-attachment": "^0.6.0", + "@hcengineering/model-chunter": "^0.6.0", "@hcengineering/model-contact": "^0.6.1", "@hcengineering/model-core": "^0.6.0", "@hcengineering/model-presentation": "^0.6.0", "@hcengineering/model-tags": "^0.6.0", "@hcengineering/model-view": "^0.6.0", "@hcengineering/model-workbench": "^0.6.1", - "@hcengineering/notification": "^0.6.16", "@hcengineering/platform": "^0.6.9", "@hcengineering/tags": "^0.6.12", "@hcengineering/task": "^0.6.13", diff --git a/models/task/src/index.ts b/models/task/src/index.ts index db5224f70c..d65735874b 100644 --- a/models/task/src/index.ts +++ b/models/task/src/index.ts @@ -59,8 +59,9 @@ import { } from '@hcengineering/task' import type { AnyComponent } from '@hcengineering/ui/src/types' import { type ViewAction } from '@hcengineering/view' +import chunter from '@hcengineering/model-chunter' + import task from './plugin' -import notification from '@hcengineering/notification' export { taskId } from '@hcengineering/task' export { createProjectType, createSequence, taskOperation } from './migration' @@ -95,7 +96,7 @@ export class TTask extends TAttachedDoc implements Task { @Prop(Collection(tags.class.TagReference, task.string.TaskLabels), task.string.TaskLabels) labels?: number - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments?: number @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) diff --git a/models/task/src/plugin.ts b/models/task/src/plugin.ts index 5a5a5e673c..a8d397cd88 100644 --- a/models/task/src/plugin.ts +++ b/models/task/src/plugin.ts @@ -21,7 +21,6 @@ import { taskId } from '@hcengineering/task' import task from '@hcengineering/task-resources/src/plugin' import type { AnyComponent } from '@hcengineering/ui/src/types' import type { Action, ActionCategory, ViewAction, Viewlet } from '@hcengineering/view' -import {} from '@hcengineering/notification' export default mergeIds(taskId, task, { action: { diff --git a/models/telegram/src/index.ts b/models/telegram/src/index.ts index 0bef9cb66f..0271ba1d8f 100644 --- a/models/telegram/src/index.ts +++ b/models/telegram/src/index.ts @@ -134,7 +134,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: telegram.class.Message, @@ -143,7 +143,7 @@ export function createModel (builder: Builder): void { component: telegram.notification.NotificationMessageCreated, label: telegram.string.SharedMessages }, - telegram.ids.NotificationMessageCreated + telegram.ids.TelegramMessageCreatedActivityViewlet ) builder.createDoc( @@ -191,7 +191,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: telegram.class.SharedMessages, @@ -201,7 +201,7 @@ export function createModel (builder: Builder): void { label: telegram.string.SharedMessages, hideIfRemoved: true }, - telegram.ids.NotificationMessageShared + telegram.ids.TelegramMessageSharedActivityViewlet ) builder.createDoc( diff --git a/models/telegram/src/plugin.ts b/models/telegram/src/plugin.ts index 6bc7985776..9d6229c3ac 100644 --- a/models/telegram/src/plugin.ts +++ b/models/telegram/src/plugin.ts @@ -19,9 +19,9 @@ 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 { TxViewlet } from '@hcengineering/activity' +import type { DocUpdateMessageViewlet, TxViewlet } from '@hcengineering/activity' import { type TemplateFieldFunc } from '@hcengineering/templates' -import { type DocUpdateMessageViewlet, type NotificationGroup } from '@hcengineering/notification' +import { type NotificationGroup } from '@hcengineering/notification' export default mergeIds(telegramId, telegram, { string: { @@ -43,8 +43,8 @@ export default mergeIds(telegramId, telegram, { TxSharedCreate: '' as Ref, NewMessageNotificationViewlet: '' as Ref, NotificationGroup: '' as Ref, - NotificationMessageShared: '' as Ref, - NotificationMessageCreated: '' as Ref + TelegramMessageSharedActivityViewlet: '' as Ref, + TelegramMessageCreatedActivityViewlet: '' as Ref }, function: { GetCurrentEmployeeTG: '' as Resource, diff --git a/models/tracker/package.json b/models/tracker/package.json index ca89a082f5..0b1e224091 100644 --- a/models/tracker/package.json +++ b/models/tracker/package.json @@ -26,6 +26,7 @@ }, "dependencies": { "@hcengineering/activity": "^0.6.0", + "@hcengineering/chunter": "^0.6.12", "@hcengineering/contact": "^0.6.20", "@hcengineering/core": "^0.6.28", "@hcengineering/model": "^0.6.7", diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index d8d3566e61..3c94010807 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -22,11 +22,12 @@ import workbench from '@hcengineering/model-workbench' import notification from '@hcengineering/notification' import setting from '@hcengineering/setting' import { trackerId } from '@hcengineering/tracker' -import tracker from './plugin' - import { generateClassNotificationTypes } from '@hcengineering/model-notification' import presentation from '@hcengineering/model-presentation' import { PaletteColorIndexes } from '@hcengineering/ui/src/colors' +import chunter from '@hcengineering/chunter' + +import tracker from './plugin' import { createActions as defineActions } from './actions' import { definePresenters } from './presenters' import { @@ -445,20 +446,40 @@ export function createModel (builder: Builder): void { TTypeRemainingTime ) - builder.mixin(tracker.class.Project, core.class.Class, notification.mixin.ActivityDoc, {}) - builder.mixin(tracker.class.Issue, core.class.Class, notification.mixin.ActivityDoc, { + builder.mixin(tracker.class.Project, core.class.Class, activity.mixin.ActivityDoc, {}) + builder.mixin(tracker.class.Issue, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) - builder.mixin(tracker.class.Milestone, core.class.Class, notification.mixin.ActivityDoc, { + builder.mixin(tracker.class.Milestone, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) - builder.mixin(tracker.class.Component, core.class.Class, notification.mixin.ActivityDoc, { + builder.mixin(tracker.class.Component, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) - builder.mixin(tracker.class.IssueTemplate, core.class.Class, notification.mixin.ActivityDoc, { + builder.mixin(tracker.class.IssueTemplate, core.class.Class, activity.mixin.ActivityDoc, { ignoreCollections: ['comments'] }) + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: tracker.class.Issue, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: tracker.class.Milestone, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: tracker.class.Component, + components: { input: chunter.component.ChatMessageInput } + }) + + builder.createDoc(activity.class.ActivityExtension, core.space.Model, { + ofClass: tracker.class.IssueTemplate, + components: { input: chunter.component.ChatMessageInput } + }) + defineViewlets(builder) defineStatusCategories(builder) @@ -517,7 +538,7 @@ export function createModel (builder: Builder): void { ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: tracker.class.Issue, @@ -535,11 +556,11 @@ export function createModel (builder: Builder): void { } } }, - tracker.ids.NotificationIssueUpdated + tracker.ids.IssueUpdatedActivityViewlet ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: tracker.class.Issue, @@ -547,11 +568,11 @@ export function createModel (builder: Builder): void { icon: tracker.icon.Issue, valueAttr: 'title' }, - tracker.ids.NotificationIssueCreated + tracker.ids.IssueCreatedActivityViewlet ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: tracker.class.Issue, @@ -559,11 +580,11 @@ export function createModel (builder: Builder): void { icon: tracker.icon.Issue, valueAttr: 'title' }, - tracker.ids.NotificationIssueRemoved + tracker.ids.IssueRemovedActivityViewlet ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: tracker.class.Milestone, @@ -574,11 +595,11 @@ export function createModel (builder: Builder): void { } } }, - tracker.ids.NotificationMilestoneUpdated + tracker.ids.MilestionUpdatedActivityViewlet ) builder.createDoc( - notification.class.DocUpdateMessageViewlet, + activity.class.DocUpdateMessageViewlet, core.space.Model, { objectClass: tracker.class.IssueTemplate, @@ -589,7 +610,7 @@ export function createModel (builder: Builder): void { } } }, - tracker.ids.NotificationIssueTemplateUpdated + tracker.ids.IssueTemplateUpdatedActivityViewlet ) defineApplication(builder, { myIssuesId, allIssuesId, issuesId, componentsId, milestonesId, templatesId }) @@ -625,41 +646,41 @@ export function createModel (builder: Builder): void { }) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: tracker.class.Issue, - label: notification.string.LeftComment + label: chunter.string.LeftComment }, tracker.ids.IssueChatMessageViewlet ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: tracker.class.IssueTemplate, - label: notification.string.LeftComment + label: chunter.string.LeftComment }, tracker.ids.IssueTemplateChatMessageViewlet ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: tracker.class.Component, - label: notification.string.LeftComment + label: chunter.string.LeftComment }, tracker.ids.ComponentChatMessageViewlet ) builder.createDoc( - notification.class.ChatMessageViewlet, + chunter.class.ChatMessageViewlet, core.space.Model, { objectClass: tracker.class.Milestone, - label: notification.string.LeftComment + label: chunter.string.LeftComment }, tracker.ids.MilestoneChatMessageViewlet ) diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index 89d1b0abef..1cd9f61d83 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -22,13 +22,9 @@ import tracker from '@hcengineering/tracker-resources/src/plugin' import type { AnyComponent } from '@hcengineering/ui/src/types' import { type Action, type ViewAction, type Viewlet } from '@hcengineering/view' import { type Application } from '@hcengineering/workbench' -import { type TxViewlet } from '@hcengineering/activity' -import { - type ChatMessageViewlet, - type DocUpdateMessageViewlet, - type NotificationGroup, - type NotificationType -} from '@hcengineering/notification' +import { type DocUpdateMessageViewlet, type TxViewlet } from '@hcengineering/activity' +import { type NotificationGroup, type NotificationType } from '@hcengineering/notification' +import { type ChatMessageViewlet } from '@hcengineering/chunter' export default mergeIds(trackerId, tracker, { string: { @@ -81,11 +77,11 @@ export default mergeIds(trackerId, tracker, { TrackerNotificationGroup: '' as Ref, AssigneeNotification: '' as Ref, BaseProjectType: '' as Ref, - NotificationIssueUpdated: '' as Ref, - NotificationIssueCreated: '' as Ref, - NotificationIssueRemoved: '' as Ref, - NotificationMilestoneUpdated: '' as Ref, - NotificationIssueTemplateUpdated: '' as Ref, + IssueUpdatedActivityViewlet: '' as Ref, + IssueCreatedActivityViewlet: '' as Ref, + IssueRemovedActivityViewlet: '' as Ref, + MilestionUpdatedActivityViewlet: '' as Ref, + IssueTemplateUpdatedActivityViewlet: '' as Ref, IssueChatMessageViewlet: '' as Ref, IssueTemplateChatMessageViewlet: '' as Ref, ComponentChatMessageViewlet: '' as Ref, diff --git a/models/tracker/src/types.ts b/models/tracker/src/types.ts index 249ede0161..bf3c9a54b2 100644 --- a/models/tracker/src/types.ts +++ b/models/tracker/src/types.ts @@ -64,7 +64,7 @@ import { type TimeSpendReport } from '@hcengineering/tracker' import tracker from './plugin' -import notification from '@hcengineering/notification' +import chunter from '@hcengineering/chunter' export const DOMAIN_TRACKER = 'tracker' as Domain @@ -288,7 +288,7 @@ export class TIssueTemplate extends TDoc implements IssueTemplate { @Prop(ArrOf(TypeRef(tracker.class.IssueTemplate)), tracker.string.IssueTemplate) children!: IssueTemplateChild[] - @Prop(Collection(notification.class.ChatMessage), tracker.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), tracker.string.Comments) comments!: number @Prop(Collection(attachment.class.Attachment), tracker.string.Attachments) @@ -336,7 +336,7 @@ export class TComponent extends TDoc implements Component { @Prop(TypeRef(contact.mixin.Employee), tracker.string.ComponentLead) lead!: Ref | null - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments!: number @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) @@ -362,7 +362,7 @@ export class TMilestone extends TDoc implements Milestone { @Index(IndexKind.Indexed) status!: MilestoneStatus - @Prop(Collection(notification.class.ChatMessage), notification.string.Comments) + @Prop(Collection(chunter.class.ChatMessage), chunter.string.Comments) comments!: number @Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files }) diff --git a/models/view/src/index.ts b/models/view/src/index.ts index 1b84435ca6..0e8c98dc67 100644 --- a/models/view/src/index.ts +++ b/models/view/src/index.ts @@ -85,7 +85,6 @@ import { type Viewlet, type ViewletDescriptor, type ViewletPreference, - type NotificationAttributePresenter, type ObjectIdentifier } from '@hcengineering/view' @@ -127,9 +126,6 @@ export function classPresenter ( builder.mixin(_class, core.class.Class, view.mixin.ActivityAttributePresenter, { presenter: activity }) - builder.mixin(_class, core.class.Class, view.mixin.NotificationAttributePresenter, { - presenter: activity - }) } } @@ -210,11 +206,6 @@ export class TActivityAttributePresenter extends TClass implements ActivityAttri presenter!: AnyComponent } -@Mixin(view.mixin.NotificationAttributePresenter, core.class.Class) -export class TNotificationAttributePresenter extends TClass implements NotificationAttributePresenter { - presenter!: AnyComponent -} - @Mixin(view.mixin.SpacePresenter, core.class.Class) export class TSpacePresenter extends TClass implements SpacePresenter { presenter!: AnyComponent @@ -424,7 +415,6 @@ export function createModel (builder: Builder): void { TAttributePresenter, TAttributeFilterPresenter, TActivityAttributePresenter, - TNotificationAttributePresenter, TListItemPresenter, TCollectionEditor, TCollectionPresenter, @@ -479,8 +469,7 @@ export function createModel (builder: Builder): void { core.class.TypeMarkup, view.component.MarkupPresenter, view.component.MarkupEditor, - view.component.MarkupEditorPopup, - view.component.MarkupDiffPresenter + view.component.MarkupEditorPopup ) builder.mixin(core.class.TypeMarkup, core.class.Class, view.mixin.InlineAttributEditor, { diff --git a/packages/platform/package.json b/packages/platform/package.json index 1025db4c4b..4ff9af9237 100644 --- a/packages/platform/package.json +++ b/packages/platform/package.json @@ -20,19 +20,19 @@ }, "devDependencies": { "@hcengineering/platform-rig": "^0.6.0", - "@typescript-eslint/eslint-plugin": "^6.11.0", - "eslint-plugin-import": "^2.26.0", - "eslint-plugin-promise": "^6.1.1", - "eslint-plugin-n": "^15.4.0", - "eslint": "^8.54.0", - "@typescript-eslint/parser": "^6.11.0", - "eslint-config-standard-with-typescript": "^40.0.0", - "prettier": "^3.1.0", - "typescript": "^5.2.2", - "jest": "^29.7.0", - "ts-jest": "^29.1.1", "@types/jest": "^29.5.5", - "prettier-plugin-svelte": "^3.1.0" + "@typescript-eslint/eslint-plugin": "^6.11.0", + "@typescript-eslint/parser": "^6.11.0", + "eslint": "^8.54.0", + "eslint-config-standard-with-typescript": "^40.0.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-n": "^15.4.0", + "eslint-plugin-promise": "^6.1.1", + "jest": "^29.7.0", + "prettier": "^3.1.0", + "prettier-plugin-svelte": "^3.1.0", + "ts-jest": "^29.1.1", + "typescript": "^5.2.2" }, "dependencies": { "intl-messageformat": "^9.7.1" diff --git a/plugins/activity-assets/assets/icons.svg b/plugins/activity-assets/assets/icons.svg index 6c06657658..8d93443196 100644 --- a/plugins/activity-assets/assets/icons.svg +++ b/plugins/activity-assets/assets/icons.svg @@ -4,4 +4,9 @@ + + + diff --git a/plugins/activity-assets/lang/en.json b/plugins/activity-assets/lang/en.json index a4bb7f45cf..dd513873d7 100644 --- a/plugins/activity-assets/lang/en.json +++ b/plugins/activity-assets/lang/en.json @@ -3,15 +3,31 @@ "Activity": "Activity", "Added": "added", "All": "All", + "AllActivity": "All activity", + "Attributes": "Attributes", "Changed": "changed", "CollectionUpdated": "Update {collection}", + "Created": "Created", "DocAdded": "added {_class}", "DocCreated": "created {_class}", "DocDeleted": "deleted {_class}", - "Edited": "edited", + "Edit": "Edit", + "Edited": "Edited", + "Emoji": "Emoji", + "For": "For", "From": "from", + "In": "In", + "New": "New", + "NewestFirst": "Newest first", + "Pinned": "Pinned", + "Reacted": "Reacted", + "Reactions": "Reactions", "Removed": "removed", + "Set": "set", "To": "to", - "Unset": "unset" + "Unset": "Unset", + "Update": "Update", + "Updated": "Updated", + "UpdatedCollection": "Updated" } } \ No newline at end of file diff --git a/plugins/activity-assets/lang/ru.json b/plugins/activity-assets/lang/ru.json index ac2bfcfd87..e52187ab23 100644 --- a/plugins/activity-assets/lang/ru.json +++ b/plugins/activity-assets/lang/ru.json @@ -1,17 +1,33 @@ { "string": { "Activity": "Активность", - "Added": "добавила(а)", + "Added": "Добавила(а)", "All": "Все", - "Changed": "изменил(а)", + "AllActivity": "Вся активнось", + "Attributes": "Атрибуты", + "Changed": "Изменил(а)", "CollectionUpdated": "Обновлена {collection}", + "Created": "Создал(a)", "DocAdded": "добавил(а) {_class}", "DocCreated": "создал(а) {_class}", "DocDeleted": "удалил(а) {_class}", - "Edited": "отредактировал(а)", + "Edit": "Редактировать", + "Edited": "Изменено", + "Emoji": "Эмодзи", + "For": "Для", "From": "из", - "Removed": "удалил(а)", + "In": "В", + "New": "Новые", + "NewestFirst": "Сначала новые", + "Pinned": "Закрепленные", + "Reacted": "Отреагировал(а)", + "Reactions": "Реакции", + "Removed": "Удалил(а)", + "Set": "установлен", "To": "на", - "Unset": "сбросил" + "Unset": "Cбросил", + "Update": "Обновить", + "Updated": "Обновил(а)", + "UpdatedCollection": "Обновленные" } } \ No newline at end of file diff --git a/plugins/activity-assets/src/index.ts b/plugins/activity-assets/src/index.ts index 3a92951599..26b1d31b03 100644 --- a/plugins/activity-assets/src/index.ts +++ b/plugins/activity-assets/src/index.ts @@ -18,5 +18,6 @@ import { loadMetadata } from '@hcengineering/platform' const icons = require('../assets/icons.svg') as string // eslint-disable-line loadMetadata(activity.icon, { - Activity: `${icons}#activity` + Activity: `${icons}#activity`, + Emoji: `${icons}#emoji` }) diff --git a/plugins/activity-resources/package.json b/plugins/activity-resources/package.json index b5d6bd40f3..3410bdb614 100644 --- a/plugins/activity-resources/package.json +++ b/plugins/activity-resources/package.json @@ -36,8 +36,9 @@ }, "dependencies": { "@hcengineering/activity": "^0.6.0", + "@hcengineering/contact": "^0.6.20", + "@hcengineering/contact-resources": "^0.6.0", "@hcengineering/core": "^0.6.28", - "@hcengineering/notification": "^0.6.16", "@hcengineering/platform": "^0.6.9", "@hcengineering/presentation": "^0.6.2", "@hcengineering/ui": "^0.6.11", diff --git a/plugins/notification-resources/src/activityMessagesUtils.ts b/plugins/activity-resources/src/activityMessagesUtils.ts similarity index 85% rename from plugins/notification-resources/src/activityMessagesUtils.ts rename to plugins/activity-resources/src/activityMessagesUtils.ts index d9b6ff38ae..42bdb8fb8b 100644 --- a/plugins/notification-resources/src/activityMessagesUtils.ts +++ b/plugins/activity-resources/src/activityMessagesUtils.ts @@ -28,19 +28,8 @@ import core, { type TxCUD, type TxMixin, TxProcessor, - type TxUpdateDoc, - type WithLookup + type TxUpdateDoc } from '@hcengineering/core' -import notification, { - type ActivityMessage, - type ChatMessage, - type DisplayActivityMessage, - type DisplayDocUpdateMessage, - type DocAttributeUpdates, - type DocNotifyContext, - type DocUpdateMessage, - type InboxNotification -} from '@hcengineering/notification' import view, { type AttributeModel } from '@hcengineering/view' import { getClient, getFiltredKeys } from '@hcengineering/presentation' import { getAttributePresenter, getDocLinkTitle } from '@hcengineering/view-resources' @@ -49,6 +38,13 @@ import { type IntlString } from '@hcengineering/platform' import { type AnyComponent } from '@hcengineering/ui' import { get } from 'svelte/store' import { personAccountByIdStore } from '@hcengineering/contact-resources' +import activity, { + type ActivityMessage, + type DisplayActivityMessage, + type DisplayDocUpdateMessage, + type DocAttributeUpdates, + type DocUpdateMessage +} from '@hcengineering/activity' // Use 5 minutes to combine similar messages const combineThresholdMs = 5 * 60 * 1000 @@ -131,7 +127,7 @@ export function getCollectionAttribute ( return undefined } -export async function getNotificationObject ( +export async function getActivityObject ( client: Client, objectId: Ref, objectClass: Ref> @@ -176,65 +172,20 @@ export async function getAttributeModel ( attrObjectClass, attrKey, { key: attrKey }, - view.mixin.NotificationAttributePresenter + view.mixin.ActivityAttributePresenter ) } catch (e) { // ignore error } } -function activityMessagesComparator (message1: ActivityMessage, message2: ActivityMessage): number { +export function activityMessagesComparator (message1: ActivityMessage, message2: ActivityMessage): number { const time1 = getMessageTime(message1) const time2 = getMessageTime(message2) return time1 - time2 } -export function getDisplayActivityMessagesByNotifications ( - inboxNotifications: Array>, - docNotifyContextById: Map, DocNotifyContext>, - filter: 'all' | 'read' | 'unread', - objectClass?: Ref> -): DisplayActivityMessage[] { - const messages = inboxNotifications - .filter(({ docNotifyContext, isViewed }) => { - const update = docNotifyContextById.get(docNotifyContext) - const isVisible = update !== undefined && !update.hidden - - if (!isVisible) { - return false - } - - switch (filter) { - case 'unread': - return !isViewed - case 'all': - return true - case 'read': - return !!isViewed - } - - return false - }) - .map(({ $lookup }) => $lookup?.attachedTo) - .filter((message): message is ActivityMessage => { - if (message === undefined) { - return false - } - if (objectClass === undefined) { - return true - } - if (message._class === notification.class.ChatMessage) { - return false - } - - return (message as DocUpdateMessage).objectClass === objectClass - }) - .sort(activityMessagesComparator) - - return combineActivityMessages(messages, SortingOrder.Descending) -} - function getMessageTime (message: ActivityMessage): number { return message.createdOn ?? message.modifiedOn } @@ -265,15 +216,13 @@ export function combineActivityMessages ( messages: ActivityMessage[], sortingOrder: SortingOrder = SortingOrder.Ascending ): DisplayActivityMessage[] { - const chatMessages = messages.filter( - (message): message is ChatMessage => message._class === notification.class.ChatMessage - ) + const uncombinedMessages = messages.filter((message) => message._class !== activity.class.DocUpdateMessage) const docUpdateMessages = combineByCreateThreshold( - messages.filter((message): message is DocUpdateMessage => message._class === notification.class.DocUpdateMessage) + messages.filter((message): message is DocUpdateMessage => message._class === activity.class.DocUpdateMessage) ) - const result: DisplayActivityMessage[] = [...chatMessages] + const result: DisplayActivityMessage[] = [...uncombinedMessages] const groupedByType: Map = groupByArray(docUpdateMessages, getDocUpdateMessageKey) @@ -473,17 +422,13 @@ function getAttributeUpdatesKey (message: DocUpdateMessage): string { } export function attributesFilter (message: ActivityMessage, _class?: Ref): boolean { - if (message._class === notification.class.DocUpdateMessage) { + if (message._class === activity.class.DocUpdateMessage) { return (message as DocUpdateMessage).objectClass === _class } return false } -export function chatMessagesFilter (message: ActivityMessage): boolean { - return message._class === notification.class.ChatMessage -} - export function pinnedFilter (message: ActivityMessage, _class?: Ref): boolean { return message.isPinned === true } @@ -506,9 +451,9 @@ export async function getLinkData ( let linkObject: Doc | undefined - if (hierarchy.isDerived(message.attachedToClass, notification.class.ActivityMessage)) { + if (hierarchy.isDerived(message.attachedToClass, activity.class.ActivityMessage)) { linkObject = parentObject - } else if (message._class === notification.class.DocUpdateMessage) { + } else if (message._class === activity.class.DocUpdateMessage) { linkObject = (message as DocUpdateMessage).action === 'update' ? object : parentObject ?? object } else { linkObject = parentObject ?? object @@ -524,13 +469,12 @@ export async function getLinkData ( const title = await getDocLinkTitle(client, linkObject._id, linkObject._class, linkObject) - const preposition = hierarchy.classHierarchyMixin(linkObject._class, notification.mixin.NotificationObjectPreposition) - ?.preposition + const preposition = hierarchy.classHierarchyMixin(linkObject._class, activity.mixin.ActivityDoc)?.preposition const panelComponent = hierarchy.classHierarchyMixin(linkObject._class, view.mixin.ObjectPanel) return { title, - preposition: preposition ?? notification.string.In, + preposition: preposition ?? activity.string.In, panelComponent: panelComponent?.component ?? view.component.EditDoc, object: linkObject } diff --git a/plugins/activity-resources/src/components/Activity.svelte b/plugins/activity-resources/src/components/Activity.svelte index 2348a2c1e0..9062941d64 100644 --- a/plugins/activity-resources/src/components/Activity.svelte +++ b/plugins/activity-resources/src/components/Activity.svelte @@ -13,14 +13,14 @@ // limitations under the License. --> -{#if isVisible} - +{#if extension} + {/if} diff --git a/plugins/activity-resources/src/components/ActivityFilter.svelte b/plugins/activity-resources/src/components/ActivityFilter.svelte index b046fe09fb..ad2d8be7b1 100644 --- a/plugins/activity-resources/src/components/ActivityFilter.svelte +++ b/plugins/activity-resources/src/components/ActivityFilter.svelte @@ -18,12 +18,13 @@ import { getResource } from '@hcengineering/platform' import { getClient } from '@hcengineering/presentation' import { ActionIcon, eventToHTMLElement, Icon, Label, showPopup } from '@hcengineering/ui' - import notification, { ActivityMessage, ActivityMessagesFilter } from '@hcengineering/notification' + import { ActivityMessage, ActivityMessagesFilter } from '@hcengineering/activity' import activity from '../plugin' import FilterPopup from './FilterPopup.svelte' import IconClose from './icons/Close.svelte' import IconFilter from './icons/Filter.svelte' + import { sortActivityMessages } from '../activityMessagesUtils' export let messages: ActivityMessage[] export let object: Doc @@ -40,7 +41,7 @@ $: localStorage.setItem('activity-filter', JSON.stringify(selectedFiltersRefs)) $: localStorage.setItem('activity-newest-first', JSON.stringify(isNewestFirst)) - client.findAll(notification.class.ActivityMessagesFilter, {}).then((res) => { + client.findAll(activity.class.ActivityMessagesFilter, {}).then((res) => { filters = res if (saved !== null && saved !== undefined) { @@ -83,9 +84,7 @@ selected: Ref[] | 'All', sortOrder: SortingOrder ): Promise { - const sortMessagesFn = await getResource(notification.function.SortActivityMessages) - - const sortedMessages = sortMessagesFn(messages, sortOrder).sort(({ isPinned }) => + const sortedMessages = sortActivityMessages(messages, sortOrder).sort(({ isPinned }) => isPinned && sortOrder === SortingOrder.Ascending ? -1 : 1 ) diff --git a/plugins/activity-resources/src/components/FilterPopup.svelte b/plugins/activity-resources/src/components/FilterPopup.svelte index a48df87174..2cada93358 100644 --- a/plugins/activity-resources/src/components/FilterPopup.svelte +++ b/plugins/activity-resources/src/components/FilterPopup.svelte @@ -17,7 +17,7 @@ import { IntlString } from '@hcengineering/platform' import { Label, resizeObserver, CheckBox, MiniToggle } from '@hcengineering/ui' import { Doc, Ref } from '@hcengineering/core' - import notification, { ActivityMessagesFilter } from '@hcengineering/notification' + import { ActivityMessagesFilter } from '@hcengineering/activity' import activity from '../plugin' @@ -132,7 +132,7 @@
{ dispatch('update', { action: 'toggle', value: activityOrderNewestFirst }) }} diff --git a/plugins/notification-resources/src/components/activity-message/ActivityMessageExtension.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessageExtension.svelte similarity index 96% rename from plugins/notification-resources/src/components/activity-message/ActivityMessageExtension.svelte rename to plugins/activity-resources/src/components/activity-message/ActivityMessageExtension.svelte index e11afb30af..f2f2777f84 100644 --- a/plugins/notification-resources/src/components/activity-message/ActivityMessageExtension.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessageExtension.svelte @@ -13,7 +13,7 @@ // limitations under the License. --> {#if !isHidden} {#key key} +
+ + {#if parentMessage}
@@ -167,6 +164,9 @@ class="actions clear-mins flex flex-gap-2 items-center" class:menuShowed={isActionMenuOpened || message.isPinned} > + + + {#if presenter} diff --git a/plugins/notification-resources/src/components/doc-update-message/DocUpdateMessageContent.svelte b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageContent.svelte similarity index 91% rename from plugins/notification-resources/src/components/doc-update-message/DocUpdateMessageContent.svelte rename to plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageContent.svelte index 800525f4da..613f702df4 100644 --- a/plugins/notification-resources/src/components/doc-update-message/DocUpdateMessageContent.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageContent.svelte @@ -15,14 +15,10 @@
@@ -54,11 +51,11 @@ {#if hasDifferentActions} -