[backend/api] Prevent users from biting notes they can't see
This commit is contained in:
parent
30ff0d77b2
commit
82ed8b583b
1 changed files with 5 additions and 1 deletions
|
@ -162,7 +162,11 @@ public class NoteController(
|
|||
if (user.Id == id)
|
||||
throw GracefulException.BadRequest("You cannot bite your own note");
|
||||
|
||||
var target = await db.Notes.Where(p => p.Id == id).IncludeCommonProperties().FirstOrDefaultAsync() ??
|
||||
var target = await db.Notes
|
||||
.Where(p => p.Id == id)
|
||||
.IncludeCommonProperties()
|
||||
.EnsureVisibleFor(user)
|
||||
.FirstOrDefaultAsync() ??
|
||||
throw GracefulException.NotFound("Note not found");
|
||||
|
||||
await biteSvc.BiteAsync(user, target);
|
||||
|
|
Loading…
Add table
Reference in a new issue