mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-05 00:47:32 +02: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 posts = require('../posts');
|
||||||
const socketHelpers = require('../socket.io/helpers');
|
const socketHelpers = require('../socket.io/helpers');
|
||||||
const topics = require('./index');
|
const topics = require('./index');
|
||||||
|
const categories = require('../categories');
|
||||||
const groups = require('../groups');
|
const groups = require('../groups');
|
||||||
const user = require('../user');
|
const user = require('../user');
|
||||||
|
const plugins = require('../plugins');
|
||||||
|
|
||||||
const Scheduled = module.exports;
|
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])
|
(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(
|
).concat(
|
||||||
topicsData.map(
|
topicsData.map(
|
||||||
(t, idx) => socketHelpers.notifyNew(t.uid, 'newTopic', { posts: [postsData[idx]], topic: t })
|
(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) {
|
async function updateUserLastposttimes(uids, topicsData) {
|
||||||
|
|||||||
@@ -588,7 +588,6 @@ module.exports = function (Topics) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Topics.notifyTagFollowers = async function (postData, exceptUid) {
|
Topics.notifyTagFollowers = async function (postData, exceptUid) {
|
||||||
console.log();
|
|
||||||
let { tags } = postData.topic;
|
let { tags } = postData.topic;
|
||||||
if (!tags.length) {
|
if (!tags.length) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user