mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: rejig some tertiary conditionals, fix broken inReplyTo when toPid is not defined and mainPid is a remote post
This commit is contained in:
@@ -212,12 +212,12 @@ Mocks.note = async (post) => {
|
|||||||
let inReplyTo = null;
|
let inReplyTo = null;
|
||||||
let name = null;
|
let name = null;
|
||||||
if (post.toPid) { // direct reply
|
if (post.toPid) { // direct reply
|
||||||
inReplyTo = activitypub.helpers.isUri(post.toPid) ? post.toPid : `${nconf.get('url')}/post/${post.toPid}`;
|
inReplyTo = utils.isNumber(post.toPid) ? `${nconf.get('url')}/post/${post.toPid}` : post.toPid;
|
||||||
const parentId = await posts.getPostField(post.toPid, 'uid');
|
const parentId = await posts.getPostField(post.toPid, 'uid');
|
||||||
to.unshift(activitypub.helpers.isUri(parentId) ? parentId : `${nconf.get('url')}/uid/${parentId}`);
|
to.unshift(utils.isNumber(parentId) ? `${nconf.get('url')}/uid/${parentId}` : parentId);
|
||||||
} else if (!post.isMainPost) { // reply to OP
|
} else if (!post.isMainPost) { // reply to OP
|
||||||
inReplyTo = `${nconf.get('url')}/post/${post.topic.mainPid}`;
|
inReplyTo = utils.isNumber(post.topic.mainPid) ? `${nconf.get('url')}/post/${post.topic.mainPid}` : post.topic.mainPid;
|
||||||
to.unshift(activitypub.helpers.isUri(post.topic.uid) ? post.topic.uid : `${nconf.get('url')}/uid/${post.topic.uid}`);
|
to.unshift(utils.isNumber(post.topic.uid) ? `${nconf.get('url')}/uid/${post.topic.uid}` : post.topic.uid);
|
||||||
} else { // new topic
|
} else { // new topic
|
||||||
name = await topics.getTitleByPid(post.pid);
|
name = await topics.getTitleByPid(post.pid);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user