diff --git a/database/entities/User.ts b/database/entities/User.ts index 1b660d3a..69d438d6 100644 --- a/database/entities/User.ts +++ b/database/entities/User.ts @@ -63,12 +63,13 @@ export const getFromRequest = async (req: Request): Promise => { export const followUser = async ( follower: User, followee: User, + relationshipId: string, reblogs = false, notify = false, languages: string[] = [], ) => { const relationship = await client.relationship.update({ - where: { id: follower.id }, + where: { id: relationshipId }, data: { following: true, showingReblogs: reblogs, @@ -96,12 +97,13 @@ export const followUser = async ( export const followRequestUser = async ( follower: User, followee: User, + relationshipId: string, reblogs = false, notify = false, languages: string[] = [], ) => { const relationship = await client.relationship.update({ - where: { id: follower.id }, + where: { id: relationshipId }, data: { requested: true, showingReblogs: reblogs, diff --git a/server/api/api/v1/accounts/[id]/follow.ts b/server/api/api/v1/accounts/[id]/follow.ts index 61fb4af6..0d275d61 100644 --- a/server/api/api/v1/accounts/[id]/follow.ts +++ b/server/api/api/v1/accounts/[id]/follow.ts @@ -62,6 +62,7 @@ export default apiRoute<{ relationship = await followRequestUser( self, user, + relationship.id, reblogs, notify, languages, @@ -70,6 +71,7 @@ export default apiRoute<{ relationship = await followUser( self, user, + relationship.id, reblogs, notify, languages, diff --git a/tests/api/accounts.test.ts b/tests/api/accounts.test.ts index 5a50076f..c0293c25 100644 --- a/tests/api/accounts.test.ts +++ b/tests/api/accounts.test.ts @@ -666,7 +666,7 @@ describe("API Tests", () => { const account = (await response.json()) as APIAccount; expect(account.id).toBeDefined(); - expect(account.avatar).toBe(""); + expect(account.avatar).toBeDefined(); }); });