post-queue show category, send notification

This commit is contained in:
Baris Usakli
2017-08-16 15:15:54 -04:00
parent f56578ab50
commit 0ce3e4b691
5 changed files with 58 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ var db = require('../database');
var user = require('../user');
var meta = require('../meta');
var topics = require('../topics');
var notifications = require('../notifications');
var privileges = require('../privileges');
var socketHelpers = require('../socket.io/helpers');
@@ -43,6 +44,22 @@ module.exports = function (Posts) {
function (next) {
user.setUserField(data.uid, 'lastposttime', Date.now(), next);
},
function (next) {
notifications.create({
nid: 'post-queued-' + id,
mergeId: 'post-queue',
bodyShort: '[[notifications:post_awaiting_review]]',
bodyLong: data.content,
path: '/post-queue',
}, next);
},
function (notification, next) {
if (notification) {
notifications.pushGroups(notification, ['administrators', 'Global Moderators'], next);
} else {
next();
}
},
function (next) {
next(null, {
queued: true,
@@ -92,6 +109,9 @@ module.exports = function (Posts) {
function (next) {
db.delete('post:queue:' + id, next);
},
function (next) {
notifications.rescind('post-queued-' + id, next);
},
], callback);
};