mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	fix: update logic as to whether a post is served as an article or not
Now, if OP is less than 500 characters, it is just federated out as a Note instead.
This commit is contained in:
		| @@ -603,7 +603,6 @@ Mocks.notes.public = async (post) => { | |||||||
| 	let inReplyTo = null; | 	let inReplyTo = null; | ||||||
| 	let tag = null; | 	let tag = null; | ||||||
| 	let followersUrl; | 	let followersUrl; | ||||||
| 	const isMainPost = post.pid === post.topic.mainPid; |  | ||||||
|  |  | ||||||
| 	let name = null; | 	let name = null; | ||||||
| 	({ titleRaw: name } = await topics.getTopicFields(post.tid, ['title'])); | 	({ titleRaw: name } = await topics.getTopicFields(post.tid, ['title'])); | ||||||
| @@ -716,7 +715,9 @@ Mocks.notes.public = async (post) => { | |||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| 	// Special handling for main posts (as:Article w/ as:Note preview) | 	// Special handling for main posts (as:Article w/ as:Note preview) | ||||||
| 	const noteAttachment = isMainPost ? [...attachment] : null; | 	const plaintext = posts.sanitizePlaintext(content); | ||||||
|  | 	const isArticle = post.pid === post.topic.mainPid && plaintext.length > 500; | ||||||
|  | 	const noteAttachment = isArticle ? [...attachment] : null; | ||||||
| 	const [uploads, thumbs] = await Promise.all([ | 	const [uploads, thumbs] = await Promise.all([ | ||||||
| 		posts.uploads.listWithSizes(post.pid), | 		posts.uploads.listWithSizes(post.pid), | ||||||
| 		topics.getTopicField(post.tid, 'thumbs'), | 		topics.getTopicField(post.tid, 'thumbs'), | ||||||
| @@ -748,7 +749,7 @@ Mocks.notes.public = async (post) => { | |||||||
| 	attachment = normalizeAttachment(attachment); | 	attachment = normalizeAttachment(attachment); | ||||||
| 	let preview; | 	let preview; | ||||||
| 	let summary = null; | 	let summary = null; | ||||||
| 	if (isMainPost) { | 	if (isArticle) { | ||||||
| 		preview = { | 		preview = { | ||||||
| 			type: 'Note', | 			type: 'Note', | ||||||
| 			attributedTo: `${nconf.get('url')}/uid/${post.user.uid}`, | 			attributedTo: `${nconf.get('url')}/uid/${post.user.uid}`, | ||||||
| @@ -798,7 +799,7 @@ Mocks.notes.public = async (post) => { | |||||||
| 	let object = { | 	let object = { | ||||||
| 		'@context': 'https://www.w3.org/ns/activitystreams', | 		'@context': 'https://www.w3.org/ns/activitystreams', | ||||||
| 		id, | 		id, | ||||||
| 		type: isMainPost ? 'Article' : 'Note', | 		type: isArticle ? 'Article' : 'Note', | ||||||
| 		to: Array.from(to), | 		to: Array.from(to), | ||||||
| 		cc: Array.from(cc), | 		cc: Array.from(cc), | ||||||
| 		inReplyTo, | 		inReplyTo, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user