mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 01:56:12 +01:00
closes #6019
This commit is contained in:
@@ -70,6 +70,8 @@ module.exports = function (Posts) {
|
||||
},
|
||||
function (next) {
|
||||
next(null, {
|
||||
id: id,
|
||||
type: type,
|
||||
queued: true,
|
||||
message: '[[success:post-queued]]',
|
||||
});
|
||||
@@ -178,4 +180,27 @@ module.exports = function (Posts) {
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
Posts.editQueuedContent = function (uid, id, content, callback) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
user.isAdminOrGlobalMod(uid, next);
|
||||
},
|
||||
function (isAdminOrGlobalMod, next) {
|
||||
if (!isAdminOrGlobalMod) {
|
||||
return callback(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
db.getObject('post:queue:' + id, next);
|
||||
},
|
||||
function (data, next) {
|
||||
try {
|
||||
data.data = JSON.parse(data.data);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
data.data.content = content;
|
||||
db.setObjectField('post:queue:' + id, 'data', JSON.stringify(data.data), next);
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user