refactor: simplify remote (un)follow controller

This commit is contained in:
Julian Lam
2024-01-23 12:11:35 -05:00
parent 3bdaa8a836
commit c9feb92539
3 changed files with 8 additions and 26 deletions

View File

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