mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 01:56:12 +01:00
feat: #9511 send notifications on accept/reject
This commit is contained in:
@@ -228,10 +228,15 @@ module.exports = function (Posts) {
|
||||
}
|
||||
|
||||
Posts.removeFromQueue = async function (id) {
|
||||
const data = await getParsedObject(id);
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
await removeQueueNotification(id);
|
||||
await db.sortedSetRemove('post:queue', id);
|
||||
await db.delete(`post:queue:${id}`);
|
||||
cache.del('post-queue');
|
||||
return data;
|
||||
};
|
||||
|
||||
Posts.submitFromQueue = async function (id) {
|
||||
@@ -240,11 +245,14 @@ module.exports = function (Posts) {
|
||||
return;
|
||||
}
|
||||
if (data.type === 'topic') {
|
||||
await createTopic(data.data);
|
||||
const result = await createTopic(data.data);
|
||||
data.pid = result.postData.pid;
|
||||
} else if (data.type === 'reply') {
|
||||
await createReply(data.data);
|
||||
const result = await createReply(data.data);
|
||||
data.pid = result.pid;
|
||||
}
|
||||
await Posts.removeFromQueue(id);
|
||||
return data;
|
||||
};
|
||||
|
||||
async function getParsedObject(id) {
|
||||
@@ -260,6 +268,7 @@ module.exports = function (Posts) {
|
||||
async function createTopic(data) {
|
||||
const result = await topics.post(data);
|
||||
socketHelpers.notifyNew(data.uid, 'newTopic', { posts: [result.postData], topic: result.topicData });
|
||||
return result;
|
||||
}
|
||||
|
||||
async function createReply(data) {
|
||||
@@ -270,6 +279,7 @@ module.exports = function (Posts) {
|
||||
'downvote:disabled': !!meta.config['downvote:disabled'],
|
||||
};
|
||||
socketHelpers.notifyNew(data.uid, 'newPost', result);
|
||||
return postData;
|
||||
}
|
||||
|
||||
Posts.editQueuedContent = async function (uid, editData) {
|
||||
|
||||
Reference in New Issue
Block a user