From 5fee4e330648ed5f9be5bfedee971339639989fb Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 9 Feb 2024 11:18:23 -0500 Subject: [PATCH] fix: rejig some tertiary conditionals, fix broken inReplyTo when toPid is not defined and mainPid is a remote post --- src/activitypub/mocks.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js index 5626f84869..2a93c3dea5 100644 --- a/src/activitypub/mocks.js +++ b/src/activitypub/mocks.js @@ -212,12 +212,12 @@ Mocks.note = async (post) => { let inReplyTo = null; let name = null; 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'); - 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 - inReplyTo = `${nconf.get('url')}/post/${post.topic.mainPid}`; - to.unshift(activitypub.helpers.isUri(post.topic.uid) ? post.topic.uid : `${nconf.get('url')}/uid/${post.topic.uid}`); + inReplyTo = utils.isNumber(post.topic.mainPid) ? `${nconf.get('url')}/post/${post.topic.mainPid}` : post.topic.mainPid; + to.unshift(utils.isNumber(post.topic.uid) ? `${nconf.get('url')}/uid/${post.topic.uid}` : post.topic.uid); } else { // new topic name = await topics.getTitleByPid(post.pid); }