post-queue show category, send notification

v1.18.x
Baris Usakli 8 years ago
parent f56578ab50
commit 0ce3e4b691

@ -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 &rarr; Post &rarr; 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\""
}

@ -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.",

@ -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,

@ -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);
};

@ -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">

Loading…
Cancel
Save