mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
@@ -69,7 +69,7 @@
|
||||
"nodebb-plugin-spam-be-gone": "0.5.1",
|
||||
"nodebb-rewards-essentials": "0.0.11",
|
||||
"nodebb-theme-lavender": "5.0.1",
|
||||
"nodebb-theme-persona": "7.2.16",
|
||||
"nodebb-theme-persona": "7.2.19",
|
||||
"nodebb-theme-slick": "1.1.4",
|
||||
"nodebb-theme-vanilla": "8.1.7",
|
||||
"nodebb-widget-essentials": "4.0.1",
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
"flag_title": "Flag this post for moderation",
|
||||
|
||||
"merged_message": "This topic has been merged into <a href=\"/topic/%1\">%2</a>",
|
||||
"deleted_message": "This topic has been deleted. Only users with topic management privileges can see it.",
|
||||
|
||||
"following_topic.message": "You will now be receiving notifications when somebody posts to this topic.",
|
||||
|
||||
@@ -198,6 +198,7 @@ Topics.getTopicWithPosts = function (topicData, set, uid, start, stop, reverse,
|
||||
bookmark: async.apply(Topics.getUserBookmark, topicData.tid, uid),
|
||||
postSharing: async.apply(social.getActivePostSharing),
|
||||
deleter: async.apply(getDeleter, topicData),
|
||||
merger: async.apply(getMerger, topicData),
|
||||
related: function (next) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
@@ -223,6 +224,8 @@ Topics.getTopicWithPosts = function (topicData, set, uid, start, stop, reverse,
|
||||
topicData.postSharing = results.postSharing;
|
||||
topicData.deleter = results.deleter;
|
||||
topicData.deletedTimestampISO = utils.toISOString(topicData.deletedTimestamp);
|
||||
topicData.merger = results.merger;
|
||||
topicData.mergedTimestampISO = utils.toISOString(topicData.mergedTimestamp);
|
||||
topicData.related = results.related || [];
|
||||
|
||||
topicData.unreplied = parseInt(topicData.postcount, 10) === 1;
|
||||
@@ -290,6 +293,28 @@ function getDeleter(topicData, callback) {
|
||||
user.getUserFields(topicData.deleterUid, ['username', 'userslug', 'picture'], callback);
|
||||
}
|
||||
|
||||
function getMerger(topicData, callback) {
|
||||
if (!topicData.mergerUid) {
|
||||
return setImmediate(callback, null, null);
|
||||
}
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
async.parallel({
|
||||
merger: function (next) {
|
||||
user.getUserFields(topicData.mergerUid, ['username', 'userslug', 'picture'], next);
|
||||
},
|
||||
mergedIntoTitle: function (next) {
|
||||
Topics.getTopicField(topicData.mergeIntoTid, 'title', next);
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
results.merger.mergedIntoTitle = results.mergedIntoTitle;
|
||||
next(null, results.merger);
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
Topics.getMainPost = function (tid, uid, callback) {
|
||||
Topics.getMainPosts([tid], uid, function (err, mainPosts) {
|
||||
callback(err, Array.isArray(mainPosts) && mainPosts.length ? mainPosts[0] : null);
|
||||
|
||||
@@ -26,6 +26,13 @@ module.exports = function (Topics) {
|
||||
function (next) {
|
||||
Topics.delete(tid, uid, next);
|
||||
},
|
||||
function (next) {
|
||||
Topics.setTopicFields(tid, {
|
||||
mergeIntoTid: mergeIntoTid,
|
||||
mergerUid: uid,
|
||||
mergedTimestamp: Date.now(),
|
||||
}, next);
|
||||
},
|
||||
], next);
|
||||
}, callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user