diff --git a/server/api/api/v1/accounts/[id]/followers.ts b/server/api/api/v1/accounts/[id]/followers.ts index f6fef88e..4c65ad07 100644 --- a/server/api/api/v1/accounts/[id]/followers.ts +++ b/server/api/api/v1/accounts/[id]/followers.ts @@ -57,7 +57,7 @@ export default apiRoute( max_id ? lt(follower.id, max_id) : undefined, since_id ? gte(follower.id, since_id) : undefined, min_id ? gt(follower.id, min_id) : undefined, - sql`EXISTS (SELECT 1 FROM "Relationship" WHERE "Relationship"."subjectId" = ${otherUser.id} AND "Relationship"."objectId" = ${follower.id} AND "Relationship"."following" = true)`, + sql`EXISTS (SELECT 1 FROM "Relationship" WHERE "Relationship"."subjectId" = ${otherUser.id} AND "Relationship"."ownerId" = ${follower.id} AND "Relationship"."following" = true)`, ), // @ts-expect-error Yes I KNOW the types are wrong orderBy: (liker, { desc }) => desc(liker.id), diff --git a/server/api/api/v1/accounts/[id]/following.ts b/server/api/api/v1/accounts/[id]/following.ts index 342edf76..6ec9630b 100644 --- a/server/api/api/v1/accounts/[id]/following.ts +++ b/server/api/api/v1/accounts/[id]/following.ts @@ -57,7 +57,7 @@ export default apiRoute( max_id ? lt(following.id, max_id) : undefined, since_id ? gte(following.id, since_id) : undefined, min_id ? gt(following.id, min_id) : undefined, - sql`EXISTS (SELECT 1 FROM "Relationship" WHERE "Relationship"."subjectId" = ${following.id} AND "Relationship"."objectId" = ${otherUser.id} AND "Relationship"."following" = true)`, + sql`EXISTS (SELECT 1 FROM "Relationship" WHERE "Relationship"."subjectId" = ${following.id} AND "Relationship"."ownerId" = ${otherUser.id} AND "Relationship"."following" = true)`, ), // @ts-expect-error Yes I KNOW the types are wrong orderBy: (liker, { desc }) => desc(liker.id), diff --git a/server/api/api/v2/search/index.ts b/server/api/api/v2/search/index.ts index 124f5b59..ff4ae758 100644 --- a/server/api/api/v2/search/index.ts +++ b/server/api/api/v2/search/index.ts @@ -172,7 +172,7 @@ export default apiRoute( self?.id } AND Relationships.following = ${ following ? true : false - } AND Relationships.objectId = ${user.id})` + } AND Relationships.ownerId = ${user.id})` : undefined, ), orderBy: (user, { desc }) => desc(user.createdAt), @@ -191,7 +191,7 @@ export default apiRoute( self?.id } AND Relationships.following = ${ following ? true : false - } AND Relationships.objectId = ${status.authorId})` + } AND Relationships.ownerId = ${status.authorId})` : undefined, ), orderBy: (status, { desc }) => desc(status.createdAt),