mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-30 18:46:01 +01:00 
			
		
		
		
	fix: have replies provide name when mocked
				
					
				
			This commit is contained in:
		| @@ -231,20 +231,26 @@ Mocks.note = async (post) => { | |||||||
| 	const cc = new Set([`${nconf.get('url')}/uid/${post.user.uid}/followers`]); | 	const cc = new Set([`${nconf.get('url')}/uid/${post.user.uid}/followers`]); | ||||||
|  |  | ||||||
| 	let inReplyTo = null; | 	let inReplyTo = null; | ||||||
| 	let name = null; |  | ||||||
| 	let tag = null; | 	let tag = null; | ||||||
| 	let followersUrl; | 	let followersUrl; | ||||||
|  |  | ||||||
|  | 	let name = null; | ||||||
|  | 	({ titleRaw: name } = await topics.getTopicFields(post.tid, ['title'])); | ||||||
|  |  | ||||||
| 	if (post.toPid) { // direct reply | 	if (post.toPid) { // direct reply | ||||||
| 		inReplyTo = utils.isNumber(post.toPid) ? `${nconf.get('url')}/post/${post.toPid}` : post.toPid; | 		inReplyTo = utils.isNumber(post.toPid) ? `${nconf.get('url')}/post/${post.toPid}` : post.toPid; | ||||||
|  | 		name = `Re: ${name}`; | ||||||
|  |  | ||||||
| 		const parentId = await posts.getPostField(post.toPid, 'uid'); | 		const parentId = await posts.getPostField(post.toPid, 'uid'); | ||||||
| 		followersUrl = await user.getUserField(parentId, ['followersUrl']); | 		followersUrl = await user.getUserField(parentId, ['followersUrl']); | ||||||
| 		to.add(utils.isNumber(parentId) ? `${nconf.get('url')}/uid/${parentId}` : parentId); | 		to.add(utils.isNumber(parentId) ? `${nconf.get('url')}/uid/${parentId}` : parentId); | ||||||
| 	} else if (!post.isMainPost) { // reply to OP | 	} else if (!post.isMainPost) { // reply to OP | ||||||
| 		inReplyTo = utils.isNumber(post.topic.mainPid) ? `${nconf.get('url')}/post/${post.topic.mainPid}` : post.topic.mainPid; | 		inReplyTo = utils.isNumber(post.topic.mainPid) ? `${nconf.get('url')}/post/${post.topic.mainPid}` : post.topic.mainPid; | ||||||
|  | 		name = `Re: ${name}`; | ||||||
|  |  | ||||||
| 		to.add(utils.isNumber(post.topic.uid) ? `${nconf.get('url')}/uid/${post.topic.uid}` : post.topic.uid); | 		to.add(utils.isNumber(post.topic.uid) ? `${nconf.get('url')}/uid/${post.topic.uid}` : post.topic.uid); | ||||||
| 		followersUrl = await user.getUserField(post.topic.uid, ['followersUrl']); | 		followersUrl = await user.getUserField(post.topic.uid, ['followersUrl']); | ||||||
| 	} else { // new topic | 	} else { // new topic | ||||||
| 		({ titleRaw: name } = await topics.getTopicFields(post.tid, ['title'])); |  | ||||||
| 		tag = post.topic.tags.map(tag => ({ | 		tag = post.topic.tags.map(tag => ({ | ||||||
| 			type: 'Hashtag', | 			type: 'Hashtag', | ||||||
| 			href: `${nconf.get('url')}/tags/${tag.valueEncoded}`, | 			href: `${nconf.get('url')}/tags/${tag.valueEncoded}`, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user