mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 23:45:45 +01:00
perf: don't load thumbs if disabled globally, cache thumb results
This commit is contained in:
@@ -145,13 +145,14 @@ Topics.getTopicsByTids = async function (tids, options) {
|
||||
|
||||
// Note: Backwards compatibility with old thumb logic, remove in v1.17.0
|
||||
function restoreThumbValue(topic) {
|
||||
if (topic.thumb && !topic.thumbs.length) {
|
||||
const isArray = Array.isArray(topic.thumbs);
|
||||
if (isArray && !topic.thumbs.length && topic.thumb) {
|
||||
topic.thumbs = [{
|
||||
id: topic.tid,
|
||||
name: path.basename(topic.thumb),
|
||||
url: topic.thumb,
|
||||
}];
|
||||
} else if (topic.thumbs.length) {
|
||||
} else if (isArray && topic.thumbs.length) {
|
||||
topic.thumb = topic.thumbs[0].url;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user