Folreq fix

This commit is contained in:
Jesse Wierzbinski 2024-04-09 21:54:15 -10:00
parent dbb96027b8
commit f72671fb07
No known key found for this signature in database

View file

@ -71,6 +71,17 @@ export const followRequestUser = async (
) => { ) => {
const isRemote = follower.instanceId !== followee.instanceId; 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) { if (isRemote) {
// Federate // Federate
// TODO: Make database job // TODO: Make database job
@ -85,9 +96,17 @@ export const followRequestUser = async (
if (!response.ok) { if (!response.ok) {
console.error(await response.text()); console.error(await response.text());
throw new Error( console.error(
`Failed to federate follow request from ${follower.id} to ${followee.uri}`, `Failed to federate follow request from ${follower.id} to ${followee.uri}`,
); );
return await client.relationship.update({
where: { id: relationshipId },
data: {
following: false,
requested: false,
},
});
} }
} else { } else {
if (followee.isLocked) { if (followee.isLocked) {
@ -109,17 +128,6 @@ 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; return relationship;
}; };