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:
Barış Uşaklı
2025-07-07 10:22:24 -04:00
committed by GitHub
parent bfcc36f7cb
commit 24e7cf4a00
24 changed files with 393 additions and 429 deletions

View File

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