mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +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); | 	escapeTitle(topic); | ||||||
|  |  | ||||||
| 	// TODO: Remove in v1.17.0 |  | ||||||
| 	if (topic.hasOwnProperty('thumb')) { |  | ||||||
| 		topic.thumb = validator.escape(String(topic.thumb)); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (topic.hasOwnProperty('timestamp')) { | 	if (topic.hasOwnProperty('timestamp')) { | ||||||
| 		topic.timestampISO = utils.toISOString(topic.timestamp); | 		topic.timestampISO = utils.toISOString(topic.timestamp); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -2,7 +2,6 @@ | |||||||
|  |  | ||||||
| var _ = require('lodash'); | var _ = require('lodash'); | ||||||
| const validator = require('validator'); | const validator = require('validator'); | ||||||
| const path = require('path'); |  | ||||||
|  |  | ||||||
| var db = require('../database'); | var db = require('../database'); | ||||||
| var posts = require('../posts'); | var posts = require('../posts'); | ||||||
| @@ -116,7 +115,6 @@ Topics.getTopicsByTids = async function (tids, options) { | |||||||
| 	result.topics.forEach(function (topic, i) { | 	result.topics.forEach(function (topic, i) { | ||||||
| 		if (topic) { | 		if (topic) { | ||||||
| 			topic.thumbs = result.thumbs[i]; | 			topic.thumbs = result.thumbs[i]; | ||||||
| 			restoreThumbValue(topic); |  | ||||||
| 			topic.category = result.categoriesMap[topic.cid]; | 			topic.category = result.categoriesMap[topic.cid]; | ||||||
| 			topic.user = topic.uid ? result.usersMap[topic.uid] : { ...result.usersMap[topic.uid] }; | 			topic.user = topic.uid ? result.usersMap[topic.uid] : { ...result.usersMap[topic.uid] }; | ||||||
| 			if (result.tidToGuestHandle[topic.tid]) { | 			if (result.tidToGuestHandle[topic.tid]) { | ||||||
| @@ -144,21 +142,6 @@ Topics.getTopicsByTids = async function (tids, options) { | |||||||
| 	return hookResult.topics; | 	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) { | Topics.getTopicWithPosts = async function (topicData, set, uid, start, stop, reverse) { | ||||||
| 	const [ | 	const [ | ||||||
| 		posts, | 		posts, | ||||||
| @@ -189,7 +172,6 @@ Topics.getTopicWithPosts = async function (topicData, set, uid, start, stop, rev | |||||||
| 	]); | 	]); | ||||||
|  |  | ||||||
| 	topicData.thumbs = thumbs; | 	topicData.thumbs = thumbs; | ||||||
| 	restoreThumbValue(topicData); |  | ||||||
| 	topicData.posts = posts; | 	topicData.posts = posts; | ||||||
| 	topicData.events = events; | 	topicData.events = events; | ||||||
| 	topicData.category = category; | 	topicData.category = category; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user