Node.js based forum software built for the modern web
Merge branch 'master' into develop
Julian Lamd5349b39f5c8
diff --cc src/api/activitypub.jsindex 4701c0ca51,2752a50bc6..43dad015b1--- a/src/api/activitypub.js+++ b/src/api/activitypub.js@@@ -43,9 -44,19 +44,16 @@@ activitypubApi.follow = enabledCheck(asthrow new Error('[[error:activitypub.invalid-id]]');}- actor = actor.includes('@') ? await user.getUidByUserslug(actor) : actor;+ if (actor.includes('@')) {+ const [uid, cid] = await Promise.all([+ user.getUidByUserslug(actor),+ categories.getCidByHandle(actor),+ ]);++ actor = uid || cid;+ }- const [handle, isFollowing] = await Promise.all([- user.getUserField(actor, 'username'),- db.isSortedSetMember(type === 'uid' ? `followingRemote:${id}` : `cid:${id}:following`, actor),- ]);+ const isFollowing = await db.isSortedSetMember(type === 'uid' ? `followingRemote:${id}` : `cid:${id}:following`, actor);if (isFollowing) { // already followingreturn;}@@@ -73,10 -84,22 +81,21 @@@ activitypubApi.unfollow = enabledCheck(throw new Error('[[error:activitypub.invalid-id]]');}- actor = actor.includes('@') ? await user.getUidByUserslug(actor) : actor;+ if (actor.includes('@')) {+ const [uid, cid] = await Promise.all([+ user.getUidByUserslug(actor),+ categories.getCidByHandle(actor),+ ]);- const isFollowing = await db.isSortedSetMember(type === 'uid' ? `followingRemote:${id}` : `cid:${id}:following`, actor);- if (!isFollowing) { // already not following+ actor = uid || cid;+ }+- const [handle, isFollowing, isPending] = await Promise.all([- user.getUserField(actor, 'username'),++ const [isFollowing, isPending] = await Promise.all([+ db.isSortedSetMember(type === 'uid' ? `followingRemote:${id}` : `cid:${id}:following`, actor),+ db.isSortedSetMember(`followRequests:${type === 'uid' ? 'uid' : 'cid'}.${id}`, actor),+ ]);++ if (!isFollowing && !isPending) { // already not following/pendingreturn;}