From 8c256e4e0f5a53e51cfef7083ed01489b323ddd3 Mon Sep 17 00:00:00 2001 From: automation Date: Thu, 25 Sep 2025 22:49:31 +0000 Subject: [PATCH] UnifiedPush: set clear default test titles/messages; improve compose health gating --- docker-compose.yml | 13 ++++++++----- .../server/controllers/api-v3/pushNotifications.js | 9 ++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d2a50338e0..23fe9f3394 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,19 @@ -version: "3" services: server: build: context: . dockerfile: ./Dockerfile target: server + restart: unless-stopped depends_on: - - mongo + mongo: + condition: service_healthy environment: - - NODE_DB_URI=mongodb://mongo/habitica?replicaSet=rs # this only needs to be adapted if using a separate database - - BASE_URL=http://127.0.0.1:8080 # change this to the URL under which your instance will be reachable + - NODE_DB_URI=mongodb://mongo/habitica?replicaSet=rs # adjust if you run an external Mongo database + - BASE_URL=http://127.0.0.1:3000 # change this to the URL under which your instance will be reachable - INVITE_ONLY=false # change to `true` after registration of initial users, to restrict further registrations + - PUSH_CONFIGS_UNIFIEDPUSH_URL=${UP_BASE_URL:-} # optional: base URL for UnifiedPush distributor + - PUSH_CONFIGS_UNIFIEDPUSH_AUTHORIZATION=${UP_AUTH_HEADER:-} # optional: Authorization header for UnifiedPush networks: - habitica ports: @@ -21,7 +24,7 @@ services: hostname: mongo command: ["--replSet", "rs", "--bind_ip_all", "--port", "27017"] healthcheck: - test: echo "try { rs.status() } catch (err) { rs.initiate({_id: 'rs', members: [{ _id: 0, host: 'mongo:27017' }]}) }" | mongosh --port 27017 --quiet + test: ["CMD-SHELL", "echo \"try { rs.status() } catch (err) { rs.initiate({_id: 'rs', members: [{ _id: 0, host: 'mongo:27017' }]}) }\" | mongosh --quiet --port 27017"] interval: 10s timeout: 30s start_period: 0s diff --git a/website/server/controllers/api-v3/pushNotifications.js b/website/server/controllers/api-v3/pushNotifications.js index 0f6a310ab9..30650be8b8 100644 --- a/website/server/controllers/api-v3/pushNotifications.js +++ b/website/server/controllers/api-v3/pushNotifications.js @@ -87,11 +87,10 @@ api.sendUnifiedPushTest = { throw new NotFound(res.t('pushDeviceNotFound')); } - const notificationTitle = req.body?.title - || res.t('unifiedPushTestTitle', { defaultValue: 'Habitica UnifiedPush Test' }); - const notificationMessage = req.body?.message - || res.t('unifiedPushTestMessage', { defaultValue: 'This is a test UnifiedPush notification from Habitica.' }); - const successMessage = res.t('unifiedPushTestSent', { defaultValue: 'UnifiedPush test notification sent.' }); + // Use simple built-in defaults to avoid missing translation strings. + const notificationTitle = req.body?.title || 'Test Successful'; + const notificationMessage = req.body?.message || 'This is a test UnifiedPush notification from Habitica.'; + const successMessage = 'UnifiedPush test notification sent.'; const userForPush = user.toObject ? user.toObject() : { ...user }; userForPush._id = user._id;