mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	chore: more removals of thumb specific backwards-compatibility [breaking]
This commit is contained in:
		| @@ -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); | ||||
| 	} | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user