mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 07:17:52 +02:00
refactor: move post uploads to post hash (#13533)
* refactor: move post uploads to post hash * test: add uploads to api definition * refactor: move thumbs to topic hash * chore: up composer * refactor: dont use old zset
This commit is contained in:
@@ -29,7 +29,7 @@ module.exports = function (Posts) {
|
||||
}
|
||||
|
||||
const topicData = await topics.getTopicFields(postData.tid, [
|
||||
'cid', 'mainPid', 'title', 'timestamp', 'scheduled', 'slug', 'tags',
|
||||
'cid', 'mainPid', 'title', 'timestamp', 'scheduled', 'slug', 'tags', 'thumbs',
|
||||
]);
|
||||
|
||||
await scheduledTopicCheck(data, topicData);
|
||||
@@ -142,6 +142,15 @@ module.exports = function (Posts) {
|
||||
await topics.validateTags(data.tags, topicData.cid, data.uid, tid);
|
||||
}
|
||||
|
||||
const thumbs = topics.thumbs.filterThumbs(data.thumbs);
|
||||
const thumbsupdated = Array.isArray(data.thumbs) &&
|
||||
!_.isEqual(data.thumbs, topicData.thumbs);
|
||||
|
||||
if (thumbsupdated) {
|
||||
newTopicData.thumbs = JSON.stringify(thumbs);
|
||||
newTopicData.numThumbs = thumbs.length;
|
||||
}
|
||||
|
||||
const results = await plugins.hooks.fire('filter:topic.edit', {
|
||||
req: data.req,
|
||||
topic: newTopicData,
|
||||
@@ -172,6 +181,7 @@ module.exports = function (Posts) {
|
||||
renamed: renamed,
|
||||
tagsupdated: tagsupdated,
|
||||
tags: tags,
|
||||
thumbsupdated: thumbsupdated,
|
||||
oldTags: topicData.tags,
|
||||
rescheduled: rescheduling(data, topicData),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user