mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
feat: add action:topics.scheduled.notify
add missing notify calls into scheduled topics
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -588,7 +588,6 @@ module.exports = function (Topics) {
|
||||
};
|
||||
|
||||
Topics.notifyTagFollowers = async function (postData, exceptUid) {
|
||||
console.log();
|
||||
let { tags } = postData.topic;
|
||||
if (!tags.length) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user