[backend/masto-client] Don't forbid requesting relationship status with yourself

Some Mastodon clients rely on this (for some reason)
This commit is contained in:
Laura Hausmann 2024-02-12 03:18:01 +01:00
parent f30e7f4ac3
commit c1650da632
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -171,7 +171,7 @@ public class AccountController(
followee.FollowersCount -= followings.Count;
db.RemoveRange(followings);
await db.SaveChangesAsync();
followee.PrecomputedIsFollowedBy = false;
}
@ -208,9 +208,6 @@ public class AccountController(
public async Task<IActionResult> GetRelationships([FromQuery(Name = "id")] List<string> ids) {
var user = HttpContext.GetUserOrFail();
if (ids.Contains(user.Id))
throw GracefulException.BadRequest("You cannot request relationship status with yourself");
var users = await db.Users.IncludeCommonProperties()
.Where(p => ids.Contains(p.Id))
.PrecomputeRelationshipData(user)