mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	fix: re-use already parsed html in api.posts.edit's call to getPostSummaryByPids, delay federating out edit activity for 5s to give link preview a chance to resolve
This commit is contained in:
		| @@ -143,13 +143,16 @@ postsAPI.edit = async function (caller, data) { | |||||||
| 			newTitle: validator.escape(String(editResult.topic.title)), | 			newTitle: validator.escape(String(editResult.topic.title)), | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
| 	const postObj = await posts.getPostSummaryByPids([editResult.post.pid], caller.uid, { extraFields: ['edited'] }); | 	const postObj = await posts.getPostSummaryByPids([editResult.post.pid], caller.uid, { parse: false, extraFields: ['edited'] }); | ||||||
|  | 	postObj.content = editResult.post.content; // re-use already parsed html | ||||||
| 	const returnData = { ...postObj[0], ...editResult.post }; | 	const returnData = { ...postObj[0], ...editResult.post }; | ||||||
| 	returnData.topic = { ...postObj[0].topic, ...editResult.post.topic }; | 	returnData.topic = { ...postObj[0].topic, ...editResult.post.topic }; | ||||||
|  |  | ||||||
| 	if (!editResult.post.deleted) { | 	if (!editResult.post.deleted) { | ||||||
| 		websockets.in(`topic_${editResult.topic.tid}`).emit('event:post_edited', editResult); | 		websockets.in(`topic_${editResult.topic.tid}`).emit('event:post_edited', editResult); | ||||||
| 		await require('.').activitypub.update.note(caller, { post: postObj[0] }); | 		setTimeout(() => { | ||||||
|  | 			require('.').activitypub.update.note(caller, { post: postObj[0] }); | ||||||
|  | 		}, 5000); | ||||||
|  |  | ||||||
| 		return returnData; | 		return returnData; | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user