Node.js based forum software built for the modern web
post-queue show category, send notification
Baris Usakli0ce3e4b69178
diff --git a/public/language/en-GB/admin/manage/post-queue.json b/public/language/en-GB/admin/manage/post-queue.jsonindex 5c52e25538..f748fb0ee2 100644--- a/public/language/en-GB/admin/manage/post-queue.json+++ b/public/language/en-GB/admin/manage/post-queue.json@@ -2,7 +2,9 @@"post-queue": "Post Queue","description": "There are no posts in the post queue. <br> To enable this feature, go to <a href=\"%1\">Settings → Post → Posting Restrictions</a> and enable <strong>Post Queue</strong>.","user": "User",+ "category": "Category","title": "Title","content": "Content",- "posted": "Posted"+ "posted": "Posted",+ "reply-to": "Reply to \"%1\""}\ No newline at end of filediff --git a/public/language/en-GB/notifications.json b/public/language/en-GB/notifications.jsonindex 8c7ed9d07a..7812eabf7c 100644--- a/public/language/en-GB/notifications.json+++ b/public/language/en-GB/notifications.json@@ -45,6 +45,7 @@"new_register": "<strong>%1</strong> sent a registration request.","new_register_multiple": "There are <strong>%1</strong> registration requests awaiting review.","flag_assigned_to_you": "<strong>Flag %1</strong> has been assigned to you",+ "post_awaiting_review": "Post awaiting review","email-confirmed": "Email Confirmed","email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",diff --git a/src/controllers/admin/postqueue.js b/src/controllers/admin/postqueue.jsindex e401f7dedd..749b4c0a2a 100644--- a/src/controllers/admin/postqueue.js+++ b/src/controllers/admin/postqueue.js@@ -4,6 +4,8 @@ var async = require('async');var db = require('../../database');var user = require('../../user');+var topics = require('../../topics');+var categories = require('../../categories');var pagination = require('../../pagination');var utils = require('../../utils');@@ -51,11 +53,34 @@ postQueueController.get = function (req, res, next) {});user.getUsersFields(uids, ['username', 'userslug', 'picture'], next);},- function (userData) {+ function (userData, next) {postData.forEach(function (postData, index) {postData.user = userData[index];});+ async.map(postData, function (postData, next) {+ async.waterfall([+ function (next) {+ if (postData.data.cid) {+ next(null, { cid: postData.data.cid });+ } else if (postData.data.tid) {+ topics.getTopicFields(postData.data.tid, ['title', 'cid'], next);+ } else {+ next(null, { cid: 0 });+ }+ },+ function (topicData, next) {+ postData.topic = topicData;+ categories.getCategoryData(topicData.cid, next);+ },+ function (categoryData, next) {+ postData.category = categoryData;+ next(null, postData);+ },+ ], next);+ }, next);+ },+ function (postData) {res.render('admin/manage/post-queue', {title: '[[pages:post-queue]]',posts: postData,diff --git a/src/posts/queue.js b/src/posts/queue.jsindex 3b9f555f9d..7e0e90720f 100644--- a/src/posts/queue.js+++ b/src/posts/queue.js@@ -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);};diff --git a/src/views/admin/manage/post-queue.tpl b/src/views/admin/manage/post-queue.tplindex 86c70f2f21..001479aa58 100644--- a/src/views/admin/manage/post-queue.tpl+++ b/src/views/admin/manage/post-queue.tpl@@ -16,6 +16,7 @@<thead><tr><th>[[admin/manage/post-queue:user]]</th>+ <th>[[admin/manage/post-queue:category]]</th><th>[[admin/manage/post-queue:title]]</th><th>[[admin/manage/post-queue:content]]</th><th>[[admin/manage/post-queue:posted]]</th>@@ -33,9 +34,15 @@<!-- ENDIF posts.user.userslug --></td><td class="col-md-2">+ <a href="{config.relative_path}/category/{posts.category.slug}"><!-- IF posts.categiry.icon --><span class="fa-stack"><i style="color: {posts.category.bgColor};" class="fa fa-circle fa-stack-2x"></i><i style="color: {posts.category.color};" class="fa fa-stack-1x fa-fw {posts.category.icon}"></i></span><!-- ENDIF posts.category.icon --> {posts.category.name}</a>+ </td>+ <td class="col-md-2">+ <!-- IF posts.data.tid -->+ <a href="{config.relative_path}/topic/{posts.data.tid}">[[admin/manage/post-queue:reply-to, {posts.topic.title}]]</a>+ <!-- ENDIF posts.data.tid -->{posts.data.title}</td>- <td class="col-md-7">+ <td class="col-md-5">{posts.data.content}</td><td class="col-md-1">