Only mark as followed in database if federation works

This commit is contained in:
Jesse Wierzbinski 2024-04-09 20:22:36 -10:00
parent 5aeb50b7d5
commit cb85b4a1de
No known key found for this signature in database
2 changed files with 12 additions and 12 deletions

View file

@ -71,17 +71,6 @@ export const followRequestUser = async (
) => {
const isRemote = follower.instanceId !== followee.instanceId;
const relationship = await client.relationship.update({
where: { id: relationshipId },
data: {
following: isRemote ? false : !followee.isLocked,
requested: isRemote ? true : followee.isLocked,
showingReblogs: reblogs,
notifying: notify,
languages: languages,
},
});
if (isRemote) {
// Federate
// TODO: Make database job
@ -120,6 +109,17 @@ export const followRequestUser = async (
}
}
const relationship = await client.relationship.update({
where: { id: relationshipId },
data: {
following: isRemote ? false : !followee.isLocked,
requested: isRemote ? true : followee.isLocked,
showingReblogs: reblogs,
notifying: notify,
languages: languages,
},
});
return relationship;
};

View file

@ -68,5 +68,5 @@ export default apiRoute<{
return jsonResponse(userToAPI(account));
}
return errorResponse(`Account with username ${username} not found"`, 404);
return errorResponse(`Account with username ${username} not found`, 404);
});