From 17e1013213ebc5c362e82383966d6494252f81c1 Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Tue, 17 Sep 2024 07:32:53 +0700 Subject: [PATCH] fix: get rid of NOTIFY_INBOX_ONLY env variable (#6592) --- .vscode/launch.json | 3 +-- dev/docker-compose.yaml | 1 - qms-tests/docker-compose.yaml | 1 - server-plugins/notification-resources/src/utils.ts | 2 +- server-plugins/notification/src/index.ts | 3 ++- server/workspace-service/package.json | 1 + server/workspace-service/src/index.ts | 3 +++ tests/docker-compose.yaml | 1 - 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 2e571562ed..3dcf647f59 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -128,10 +128,9 @@ "MINIO_ACCESS_KEY": "minioadmin", "MINIO_SECRET_KEY": "minioadmin", "MINIO_ENDPOINT": "localhost", - "MODEL_VERSION": "v0.6.286", + "MODEL_VERSION": "v0.6.286" // "INIT_SCRIPT_URL": "https://raw.githubusercontent.com/hcengineering/init/main/script.yaml", // "INIT_WORKSPACE": "onboarding", - "NOTIFY_INBOX_ONLY": "true" }, "runtimeVersion": "20", "runtimeArgs": ["--nolazy", "-r", "ts-node/register"], diff --git a/dev/docker-compose.yaml b/dev/docker-compose.yaml index 6c31ffd90e..d5c15cd24c 100644 --- a/dev/docker-compose.yaml +++ b/dev/docker-compose.yaml @@ -110,7 +110,6 @@ services: - MODEL_ENABLED=* - ACCOUNTS_URL=http://host.docker.internal:3000 - BRANDING_PATH=/var/cfg/branding.json - - NOTIFY_INBOX_ONLY=true # - PARALLEL=2 # - INIT_SCRIPT_URL=https://raw.githubusercontent.com/hcengineering/init/main/script.yaml # - INIT_WORKSPACE=onboarding diff --git a/qms-tests/docker-compose.yaml b/qms-tests/docker-compose.yaml index 982aea573b..f78ff67964 100644 --- a/qms-tests/docker-compose.yaml +++ b/qms-tests/docker-compose.yaml @@ -75,7 +75,6 @@ services: - MODEL_ENABLED=* - ACCOUNTS_URL=http://account:3003 - BRANDING_PATH=/var/cfg/branding.json - - NOTIFY_INBOX_ONLY=true restart: unless-stopped front: image: hardcoreeng/front diff --git a/server-plugins/notification-resources/src/utils.ts b/server-plugins/notification-resources/src/utils.ts index f6492b9427..916876bcbe 100644 --- a/server-plugins/notification-resources/src/utils.ts +++ b/server-plugins/notification-resources/src/utils.ts @@ -200,7 +200,7 @@ export async function isShouldNotifyTx ( const result = new Map, BaseNotificationType[]>() let providers: NotificationProvider[] = control.modelDb.findAllSync(notification.class.NotificationProvider, {}) - if (process.env.NOTIFY_INBOX_ONLY === 'true') { + if (getMetadata(serverNotification.metadata.InboxOnlyNotifications) === true) { providers = providers.filter((it) => it._id === notification.providers.InboxNotificationProvider) } diff --git a/server-plugins/notification/src/index.ts b/server-plugins/notification/src/index.ts index ee077398c2..c47eed36dd 100644 --- a/server-plugins/notification/src/index.ts +++ b/server-plugins/notification/src/index.ts @@ -151,7 +151,8 @@ export default plugin(serverNotificationId, { metadata: { SesUrl: '' as Metadata, PushPrivateKey: '' as Metadata, - PushSubject: '' as Metadata + PushSubject: '' as Metadata, + InboxOnlyNotifications: '' as Metadata }, class: { NotificationProviderResources: '' as Ref> diff --git a/server/workspace-service/package.json b/server/workspace-service/package.json index af284d6b52..c9ca9bfb73 100644 --- a/server/workspace-service/package.json +++ b/server/workspace-service/package.json @@ -54,6 +54,7 @@ "@hcengineering/server-pipeline": "^0.6.0", "@hcengineering/server-client": "^0.6.0", "@hcengineering/server-token": "^0.6.11", + "@hcengineering/server-notification": "^0.6.1", "@hcengineering/analytics": "^0.6.0" } } diff --git a/server/workspace-service/src/index.ts b/server/workspace-service/src/index.ts index ebfd659791..b3e353a437 100644 --- a/server/workspace-service/src/index.ts +++ b/server/workspace-service/src/index.ts @@ -25,6 +25,7 @@ import { import { type MigrateOperation } from '@hcengineering/model' import { setMetadata } from '@hcengineering/platform' import serverClientPlugin from '@hcengineering/server-client' +import serverNotification from '@hcengineering/server-notification' import serverToken from '@hcengineering/server-token' import toolPlugin from '@hcengineering/server-tool' import { WorkspaceWorker } from './service' @@ -100,6 +101,8 @@ export function serveWorkspaceAccount ( } setMetadata(serverClientPlugin.metadata.UserAgent, 'WorkspaceService') + setMetadata(serverNotification.metadata.InboxOnlyNotifications, true) + const worker = new WorkspaceWorker( version, txes, diff --git a/tests/docker-compose.yaml b/tests/docker-compose.yaml index 76cc3f4a4c..b7dbcaf257 100644 --- a/tests/docker-compose.yaml +++ b/tests/docker-compose.yaml @@ -70,7 +70,6 @@ services: - MODEL_ENABLED=* - ACCOUNTS_URL=http://account:3003 - BRANDING_PATH=/var/cfg/branding.json - - NOTIFY_INBOX_ONLY=true restart: unless-stopped front: image: hardcoreeng/front