From cc0d562e9a1824df78d66b87668fdbbe133481b4 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 27 Jan 2021 16:17:14 -0500 Subject: [PATCH] chore: more removals of thumb specific backwards-compatibility [breaking] --- src/topics/data.js | 5 ----- src/topics/index.js | 18 ------------------ 2 files changed, 23 deletions(-) diff --git a/src/topics/data.js b/src/topics/data.js index 430236b7d5..9eb948cc2b 100644 --- a/src/topics/data.js +++ b/src/topics/data.js @@ -98,11 +98,6 @@ function modifyTopic(topic, fields) { escapeTitle(topic); - // TODO: Remove in v1.17.0 - if (topic.hasOwnProperty('thumb')) { - topic.thumb = validator.escape(String(topic.thumb)); - } - if (topic.hasOwnProperty('timestamp')) { topic.timestampISO = utils.toISOString(topic.timestamp); } diff --git a/src/topics/index.js b/src/topics/index.js index a5a947e65b..edb528c96e 100644 --- a/src/topics/index.js +++ b/src/topics/index.js @@ -2,7 +2,6 @@ var _ = require('lodash'); const validator = require('validator'); -const path = require('path'); var db = require('../database'); var posts = require('../posts'); @@ -116,7 +115,6 @@ Topics.getTopicsByTids = async function (tids, options) { result.topics.forEach(function (topic, i) { if (topic) { topic.thumbs = result.thumbs[i]; - restoreThumbValue(topic); topic.category = result.categoriesMap[topic.cid]; topic.user = topic.uid ? result.usersMap[topic.uid] : { ...result.usersMap[topic.uid] }; if (result.tidToGuestHandle[topic.tid]) { @@ -144,21 +142,6 @@ Topics.getTopicsByTids = async function (tids, options) { return hookResult.topics; }; -// Note: Backwards compatibility with old thumb logic, remove in v1.17.0 -function restoreThumbValue(topic) { - 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 (isArray && topic.thumbs.length) { - topic.thumb = topic.thumbs[0].url; - } -} -// end - Topics.getTopicWithPosts = async function (topicData, set, uid, start, stop, reverse) { const [ posts, @@ -189,7 +172,6 @@ Topics.getTopicWithPosts = async function (topicData, set, uid, start, stop, rev ]); topicData.thumbs = thumbs; - restoreThumbValue(topicData); topicData.posts = posts; topicData.events = events; topicData.category = category;