Node.js based forum software built for the modern web
feat: #9855, allow uid for post queue notifications
Barış Soner Uşaklı5aea6c6aa13a
diff --git a/public/language/en-GB/admin/settings/notifications.json b/public/language/en-GB/admin/settings/notifications.jsonindex 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 filediff --git a/src/socket.io/posts.js b/src/socket.io/posts.jsindex 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.tplindex 3e68295699..7fc1934832 100644--- a/src/views/admin/settings/notifications.tpl+++ b/src/views/admin/settings/notifications.tpl@@ -7,6 +7,7 @@<strong>[[admin/settings/notifications:welcome-notification]]</strong><br /> <textarea class="form-control" data-field="welcomeNotification"></textarea><br /><strong>[[admin/settings/notifications:welcome-notification-link]]</strong><br /> <input type="text" class="form-control" data-field="welcomeLink"><br /><strong>[[admin/settings/notifications:welcome-notification-uid]]</strong><br /> <input type="text" class="form-control" data-field="welcomeUid"><br />+ <strong>[[admin/settings/notifications:post-queue-notification-uid]]</strong><br /> <input type="text" class="form-control" data-field="postQueueNotificationUid"><br /></form></div></div>