mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
Folreq fix
This commit is contained in:
parent
dbb96027b8
commit
f72671fb07
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue