From 5aea6c6aa13ae93d15fa2a456f5893e87b932ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 3 Oct 2021 15:05:30 -0400 Subject: [PATCH] feat: #9855, allow uid for post queue notifications --- public/language/en-GB/admin/settings/notifications.json | 3 ++- src/socket.io/posts.js | 8 ++++++-- src/views/admin/settings/notifications.tpl | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/public/language/en-GB/admin/settings/notifications.json b/public/language/en-GB/admin/settings/notifications.json index da6c9680a3..c6d8b928ce 100644 --- a/public/language/en-GB/admin/settings/notifications.json +++ b/public/language/en-GB/admin/settings/notifications.json @@ -2,5 +2,6 @@ "notifications": "Notifications", "welcome-notification": "Welcome Notification", "welcome-notification-link": "Welcome Notification Link", - "welcome-notification-uid": "Welcome Notification User (UID)" + "welcome-notification-uid": "Welcome Notification User (UID)", + "post-queue-notification-uid": "Post Queue User (UID)" } \ No newline at end of file diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 7ff99d6992..a4ab025cc4 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -150,13 +150,17 @@ async function acceptOrReject(method, socket, data) { } async function sendQueueNotification(type, targetUid, path) { - const notifObj = await notifications.create({ + const notifData = { type: type, nid: `${type}-${targetUid}-${path}`, bodyShort: type === 'post-queue-accepted' ? '[[notifications:post-queue-accepted]]' : '[[notifications:post-queue-rejected]]', path: path, - }); + }; + if (parseInt(meta.config.postQueueNotificationUid, 10) > 0) { + notifData.from = meta.config.postQueueNotificationUid; + } + const notifObj = await notifications.create(notifData); await notifications.push(notifObj, [targetUid]); } diff --git a/src/views/admin/settings/notifications.tpl b/src/views/admin/settings/notifications.tpl index 3e68295699..7fc1934832 100644 --- a/src/views/admin/settings/notifications.tpl +++ b/src/views/admin/settings/notifications.tpl @@ -7,6 +7,7 @@ [[admin/settings/notifications:welcome-notification]]

[[admin/settings/notifications:welcome-notification-link]]

[[admin/settings/notifications:welcome-notification-uid]]

+ [[admin/settings/notifications:post-queue-notification-uid]]