[backend/api] Check if user is following instead of if user exists
This commit is contained in:
parent
ea5408c182
commit
02e32c70c7
1 changed files with 3 additions and 2 deletions
|
@ -150,8 +150,9 @@ public class UserController(
|
|||
if (user.Id == id)
|
||||
throw GracefulException.BadRequest("You cannot unfollow yourself");
|
||||
|
||||
var follower = await db.Users
|
||||
.Where(p => p.Id == id)
|
||||
var follower = await db.Followings
|
||||
.Where(p => p.FolloweeId == user.Id && p.FollowerId == id)
|
||||
.Select(p => p.Follower)
|
||||
.IncludeCommonProperties()
|
||||
.PrecomputeRelationshipData(user)
|
||||
.FirstOrDefaultAsync() ??
|
||||
|
|
Loading…
Add table
Reference in a new issue