Skip to content

Node.js based forum software built for the modern web

feat: add action:topics.scheduled.notify

Barış Soner Uşaklı705796f6289d
diff --git a/src/topics/scheduled.js b/src/topics/scheduled.js
index 0a91067d59..5b98bea84f 100644
--- a/src/topics/scheduled.js
+++ b/src/topics/scheduled.js
@@ -8,8 +8,10 @@ const db = require('../database');
const posts = require('../posts');
const socketHelpers = require('../socket.io/helpers');
const topics = require('./index');
+const categories = require('../categories');
const groups = require('../groups');
const user = require('../user');
+const plugins = require('../plugins');
const Scheduled = module.exports;
@@ -117,13 +119,21 @@ async function sendNotifications(uids, topicsData) {
}
});
- return Promise.all(topicsData.map(
+ await Promise.all(topicsData.map(
(t, idx) => user.notifications.sendTopicNotificationToFollowers(t.uid, t, postsData[idx])
+ ).concat(
+ postsData.map(p => topics.notifyTagFollowers(p, p.uid))
+ ).concat(
+ postsData.map(p => categories.notifyCategoryFollowers(p, p.uid))
).concat(
topicsData.map(
(t, idx) => socketHelpers.notifyNew(t.uid, 'newTopic', { posts: [postsData[idx]], topic: t })
)
));
+ plugins.hooks.fire('action:topics.scheduled.notify', {
+ posts: postsData,
+ topics: topicsData,
+ });
}
async function updateUserLastposttimes(uids, topicsData) {
diff --git a/src/topics/tags.js b/src/topics/tags.js
index 540bd314bd..2cc8be1ffa 100644
--- a/src/topics/tags.js
+++ b/src/topics/tags.js
@@ -588,7 +588,6 @@ module.exports = function (Topics) {
};
Topics.notifyTagFollowers = async function (postData, exceptUid) {
- console.log();
let { tags } = postData.topic;
if (!tags.length) {
return;