Fixes for wrong follows

This commit is contained in:
Jesse Wierzbinski 2024-04-08 16:26:48 -10:00
parent 6c60191ab2
commit 8bda61e099
No known key found for this signature in database
3 changed files with 7 additions and 3 deletions

View file

@ -63,12 +63,13 @@ export const getFromRequest = async (req: Request): Promise<AuthData> => {
export const followUser = async ( export const followUser = async (
follower: User, follower: User,
followee: User, followee: User,
relationshipId: string,
reblogs = false, reblogs = false,
notify = false, notify = false,
languages: string[] = [], languages: string[] = [],
) => { ) => {
const relationship = await client.relationship.update({ const relationship = await client.relationship.update({
where: { id: follower.id }, where: { id: relationshipId },
data: { data: {
following: true, following: true,
showingReblogs: reblogs, showingReblogs: reblogs,
@ -96,12 +97,13 @@ export const followUser = async (
export const followRequestUser = async ( export const followRequestUser = async (
follower: User, follower: User,
followee: User, followee: User,
relationshipId: string,
reblogs = false, reblogs = false,
notify = false, notify = false,
languages: string[] = [], languages: string[] = [],
) => { ) => {
const relationship = await client.relationship.update({ const relationship = await client.relationship.update({
where: { id: follower.id }, where: { id: relationshipId },
data: { data: {
requested: true, requested: true,
showingReblogs: reblogs, showingReblogs: reblogs,

View file

@ -62,6 +62,7 @@ export default apiRoute<{
relationship = await followRequestUser( relationship = await followRequestUser(
self, self,
user, user,
relationship.id,
reblogs, reblogs,
notify, notify,
languages, languages,
@ -70,6 +71,7 @@ export default apiRoute<{
relationship = await followUser( relationship = await followUser(
self, self,
user, user,
relationship.id,
reblogs, reblogs,
notify, notify,
languages, languages,

View file

@ -666,7 +666,7 @@ describe("API Tests", () => {
const account = (await response.json()) as APIAccount; const account = (await response.json()) as APIAccount;
expect(account.id).toBeDefined(); expect(account.id).toBeDefined();
expect(account.avatar).toBe(""); expect(account.avatar).toBeDefined();
}); });
}); });