Wrong order in follower acceptance

This commit is contained in:
Jesse Wierzbinski 2024-04-09 21:18:41 -10:00
parent 1a27be9542
commit 27a287ab4d
No known key found for this signature in database

View file

@ -628,16 +628,16 @@ export const followAcceptToLysand = (
follower: User, follower: User,
followee: User, followee: User,
): Lysand.FollowAccept => { ): Lysand.FollowAccept => {
if (follower.instanceId) { if (!follower.instanceId) {
throw new Error("Follower must be a local user"); throw new Error("Follower must be a remote user");
} }
if (!followee.instanceId) { if (followee.instanceId) {
throw new Error("Followee must be a remote user"); throw new Error("Followee must be a local user");
} }
if (!followee.uri) { if (!follower.uri) {
throw new Error("Followee must have a URI in database"); throw new Error("Follower must have a URI in database");
} }
const id = crypto.randomUUID(); const id = crypto.randomUUID();
@ -645,12 +645,9 @@ export const followAcceptToLysand = (
return { return {
type: "FollowAccept", type: "FollowAccept",
id: id, id: id,
author: new URL( author: getUserUri(followee),
`/users/${followee.id}`,
config.http.base_url,
).toString(),
created_at: new Date().toISOString(), created_at: new Date().toISOString(),
follower: getUserUri(follower), follower: follower.uri,
uri: new URL(`/follows/${id}`, config.http.base_url).toString(), uri: new URL(`/follows/${id}`, config.http.base_url).toString(),
}; };
}; };