mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
post-queue show category, send notification
This commit is contained in:
@@ -2,7 +2,9 @@
|
|||||||
"post-queue": "Post Queue",
|
"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>.",
|
"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",
|
"user": "User",
|
||||||
|
"category": "Category",
|
||||||
"title": "Title",
|
"title": "Title",
|
||||||
"content": "Content",
|
"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": "<strong>%1</strong> sent a registration request.",
|
||||||
"new_register_multiple": "There are <strong>%1</strong> registration requests awaiting review.",
|
"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",
|
"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": "Email Confirmed",
|
||||||
"email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",
|
"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 db = require('../../database');
|
||||||
var user = require('../../user');
|
var user = require('../../user');
|
||||||
|
var topics = require('../../topics');
|
||||||
|
var categories = require('../../categories');
|
||||||
var pagination = require('../../pagination');
|
var pagination = require('../../pagination');
|
||||||
var utils = require('../../utils');
|
var utils = require('../../utils');
|
||||||
|
|
||||||
@@ -51,11 +53,34 @@ postQueueController.get = function (req, res, next) {
|
|||||||
});
|
});
|
||||||
user.getUsersFields(uids, ['username', 'userslug', 'picture'], next);
|
user.getUsersFields(uids, ['username', 'userslug', 'picture'], next);
|
||||||
},
|
},
|
||||||
function (userData) {
|
function (userData, next) {
|
||||||
postData.forEach(function (postData, index) {
|
postData.forEach(function (postData, index) {
|
||||||
postData.user = userData[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', {
|
res.render('admin/manage/post-queue', {
|
||||||
title: '[[pages:post-queue]]',
|
title: '[[pages:post-queue]]',
|
||||||
posts: postData,
|
posts: postData,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ var db = require('../database');
|
|||||||
var user = require('../user');
|
var user = require('../user');
|
||||||
var meta = require('../meta');
|
var meta = require('../meta');
|
||||||
var topics = require('../topics');
|
var topics = require('../topics');
|
||||||
|
var notifications = require('../notifications');
|
||||||
var privileges = require('../privileges');
|
var privileges = require('../privileges');
|
||||||
var socketHelpers = require('../socket.io/helpers');
|
var socketHelpers = require('../socket.io/helpers');
|
||||||
|
|
||||||
@@ -43,6 +44,22 @@ module.exports = function (Posts) {
|
|||||||
function (next) {
|
function (next) {
|
||||||
user.setUserField(data.uid, 'lastposttime', Date.now(), 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) {
|
function (next) {
|
||||||
next(null, {
|
next(null, {
|
||||||
queued: true,
|
queued: true,
|
||||||
@@ -92,6 +109,9 @@ module.exports = function (Posts) {
|
|||||||
function (next) {
|
function (next) {
|
||||||
db.delete('post:queue:' + id, next);
|
db.delete('post:queue:' + id, next);
|
||||||
},
|
},
|
||||||
|
function (next) {
|
||||||
|
notifications.rescind('post-queued-' + id, next);
|
||||||
|
},
|
||||||
], callback);
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>[[admin/manage/post-queue:user]]</th>
|
<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:title]]</th>
|
||||||
<th>[[admin/manage/post-queue:content]]</th>
|
<th>[[admin/manage/post-queue:content]]</th>
|
||||||
<th>[[admin/manage/post-queue:posted]]</th>
|
<th>[[admin/manage/post-queue:posted]]</th>
|
||||||
@@ -33,9 +34,15 @@
|
|||||||
<!-- ENDIF posts.user.userslug -->
|
<!-- ENDIF posts.user.userslug -->
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-2">
|
<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}
|
{posts.data.title}
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-7">
|
<td class="col-md-5">
|
||||||
{posts.data.content}
|
{posts.data.content}
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-1">
|
<td class="col-md-1">
|
||||||
|
|||||||
Reference in New Issue
Block a user