refactor: update ActivityPub.get and all methods calling it to take a uid so that requests can be signed

This commit is contained in:
Julian Lam
2024-01-05 22:45:33 -05:00
parent 942a9b7e5c
commit a1c8c3a043
3 changed files with 39 additions and 31 deletions

View File

@@ -17,7 +17,7 @@ const user = require('../user');
const activitypubApi = module.exports;
activitypubApi.follow = async (caller, { actorId } = {}) => {
const object = await activitypub.getActor(actorId);
const object = await activitypub.getActor(caller.uid, actorId);
if (!object) {
throw new Error('[[error:invalid-uid]]'); // should be activitypub-specific
}
@@ -29,7 +29,7 @@ activitypubApi.follow = async (caller, { actorId } = {}) => {
};
activitypubApi.unfollow = async (caller, { actorId }) => {
const object = await activitypub.getActor(actorId);
const object = await activitypub.getActor(caller.uid, actorId);
const userslug = await user.getUserField(caller.uid, 'userslug');
if (!object) {
throw new Error('[[error:invalid-uid]]'); // should be activitypub-specific