diff --git a/dump.rdb b/dump.rdb index a26bcc6688..80eb17f6e2 100644 Binary files a/dump.rdb and b/dump.rdb differ diff --git a/public/language/ar/notifications.json b/public/language/ar/notifications.json index 2dea48c500..06ddfa34c7 100644 --- a/public/language/ar/notifications.json +++ b/public/language/ar/notifications.json @@ -46,6 +46,7 @@ "user-flagged-user-dual": "%1 and %2 flagged a user profile (%3)", "user-flagged-user-triple": "%1, %2 and %3 flagged a user profile (%4)", "user-flagged-user-multiple": "%1, %2 and %3 others flagged a user profile (%4)", + "admin-posted-to": "[COURSE FACULTY] %1 أضاف ردًا إلى: %2", "user-posted-to": "%1 أضاف ردا إلى: %2", "user-posted-to-dual": "%1 and %2 have posted replies to: %3", "user-posted-to-triple": "%1, %2 and %3 have posted replies to: %4", diff --git a/public/language/en-GB/notifications.json b/public/language/en-GB/notifications.json index 2782fdaff9..eb5b4a3382 100644 --- a/public/language/en-GB/notifications.json +++ b/public/language/en-GB/notifications.json @@ -50,6 +50,7 @@ "user-flagged-user-dual": "%1 and %2 flagged a user profile (%3)", "user-flagged-user-triple": "%1, %2 and %3 flagged a user profile (%4)", "user-flagged-user-multiple": "%1, %2 and %3 others flagged a user profile (%4)", + "admin-posted-to" : "[COURSE FACULTY] %1 has posted a reply to: %2", "user-posted-to" : "%1 has posted a reply to: %2", "user-posted-to-dual" : "%1 and %2 have posted replies to: %3", "user-posted-to-triple" : "%1, %2 and %3 have posted replies to: %4", diff --git a/public/language/en-US/notifications.json b/public/language/en-US/notifications.json index 02125c4009..c6d470da84 100644 --- a/public/language/en-US/notifications.json +++ b/public/language/en-US/notifications.json @@ -46,6 +46,7 @@ "user-flagged-user-dual": "%1 and %2 flagged a user profile (%3)", "user-flagged-user-triple": "%1, %2 and %3 flagged a user profile (%4)", "user-flagged-user-multiple": "%1, %2 and %3 others flagged a user profile (%4)", + "admin-posted-to" : "[COURSE FACULTY] %1 has posted a reply to: %2", "user-posted-to": "%1 has posted a reply to: %2", "user-posted-to-dual": "%1 and %2 have posted replies to: %3", "user-posted-to-triple": "%1, %2 and %3 have posted replies to: %4", diff --git a/public/language/es/notifications.json b/public/language/es/notifications.json index 16d514cb9c..cfb6dba8de 100644 --- a/public/language/es/notifications.json +++ b/public/language/es/notifications.json @@ -46,6 +46,7 @@ "user-flagged-user-dual": "%1 y %2 reportaron el perfil (%3)", "user-flagged-user-triple": "%1, %2 and %3 flagged a user profile (%4)", "user-flagged-user-multiple": "%1, %2 and %3 others flagged a user profile (%4)", + "admin-posted-to" : "[COURSE FACULTY] %1 ha respondido a: %2", "user-posted-to": "%1 ha respondido a: %2", "user-posted-to-dual": "%1 y %2 han respondido a %3", "user-posted-to-triple": "%1, %2 and %3 have posted replies to: %4", diff --git a/public/language/fr/notifications.json b/public/language/fr/notifications.json index a165b91046..f136229a75 100644 --- a/public/language/fr/notifications.json +++ b/public/language/fr/notifications.json @@ -46,6 +46,7 @@ "user-flagged-user-dual": "%1 et %2 ont signalé un profil utilisateur (%3)", "user-flagged-user-triple": "%1, %2 et %3 ont signalé un profil utilisateur (%4)", "user-flagged-user-multiple": "%1, %2 et %3 autres ont signalé un profil utilisateur (%4)", + "admin-posted-to": "[COURSE FACULTY] %1 a répondu à : %2", "user-posted-to": "%1 a répondu à : %2", "user-posted-to-dual": "%1 et %2 ont posté une réponse à : %3", "user-posted-to-triple": "%1, %2 et %3 ont publié des réponses à : %4", diff --git a/src/topics/create.js b/src/topics/create.js index 0d6ee1bc19..f874f8d64f 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -209,18 +209,38 @@ module.exports = function (Topics) { if (parseInt(uid, 10) || meta.config.allowGuestReplyNotifications) { const { displayname } = postData.user; - Topics.notifyFollowers(postData, uid, { - type: 'new-reply', - bodyShort: translator.compile('notifications:user-posted-to', displayname, postData.topic.title), - nid: `new_post:tid:${postData.topic.tid}:pid:${postData.pid}:uid:${uid}`, - mergeId: `notifications:user-posted-to|${postData.topic.tid}`, - }); - } + // Checks if the user is an admin + const isAdmin = await privileges.users.isAdministrator(uid); + let notificationMessage; + + if (isAdmin) { + // Handles admin/instructor notification separately so it doesn't get bundled with + // notifications of non-admin replies. + // It does this by using a different notification ID and merge ID for admin replies. + notificationMessage = translator.compile('notifications:admin-posted-to', displayname, postData.topic.title); + Topics.notifyFollowers(postData, uid, { + type: 'new-reply', + bodyShort: notificationMessage, + nid: `admin_post:tid:${postData.topic.tid}:pid:${postData.pid}:uid:${uid}`, + mergeId: `notifications:admin-posted-to|${postData.topic.tid}`, + }); + } else { + // This code handles non-admin replies, allowing bundling. + notificationMessage = translator.compile('notifications:user-posted-to', displayname, postData.topic.title); + + Topics.notifyFollowers(postData, uid, { + type: 'new-reply', + bodyShort: notificationMessage, + nid: `new_post:tid:${postData.topic.tid}:pid:${postData.pid}:uid:${uid}`, + mergeId: `notifications:user-posted-to|${postData.topic.tid}`, + }); + } - analytics.increment(['posts', `posts:byCid:${data.cid}`]); - plugins.hooks.fire('action:topic.reply', { post: _.clone(postData), data: data }); + analytics.increment(['posts', `posts:byCid:${data.cid}`]); + plugins.hooks.fire('action:topic.reply', { post: _.clone(postData), data: data }); - return postData; + return postData; + } }; async function onNewPost(postData, data) {