From b921f8d16722d72e4e3957aebe5cf314bf9ce61a Mon Sep 17 00:00:00 2001 From: Opliko Date: Tue, 9 Apr 2024 23:58:25 +0200 Subject: [PATCH] refactor: use a helper to resolve actor URI --- src/activitypub/index.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/activitypub/index.js b/src/activitypub/index.js index 6189bc575a..24b3b22679 100644 --- a/src/activitypub/index.js +++ b/src/activitypub/index.js @@ -234,21 +234,7 @@ ActivityPub.send = async (type, id, targets, payload) => { const inboxes = await ActivityPub.resolveInboxes(targets); - let actor; - switch (type) { - case 'uid': { - actor = `${nconf.get('url')}${id > 0 ? `/uid/${id}` : '/actor'}`; - break; - } - - case 'cid': { - actor = `${nconf.get('url')}/category/${id}`; - break; - } - - default: - throw new Error('[[error:activitypub.invalid-id]]'); - } + const actor = ActivityPub.helpers.resolveActor(type, id); payload = { '@context': 'https://www.w3.org/ns/activitystreams',