Skip to content

Node.js based forum software built for the modern web

refactor: use a helper to resolve actor URI

Oplikob921f8d16722
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',