[backend/masto-client] Don't silently drop invalid reply targets
This commit is contained in:
parent
c8c09591f9
commit
06e4a0ac9d
1 changed files with 2 additions and 1 deletions
|
@ -52,7 +52,8 @@ public class MastodonStatusController(DatabaseContext db, NoteRenderer noteRende
|
|||
|
||||
var visibility = Status.DecodeVisibility(request.Visibility);
|
||||
var reply = request.ReplyId != null
|
||||
? await db.Notes.Where(p => p.Id == request.ReplyId).EnsureVisibleFor(user).FirstOrDefaultAsync()
|
||||
? await db.Notes.Where(p => p.Id == request.ReplyId).EnsureVisibleFor(user).FirstOrDefaultAsync() ??
|
||||
throw GracefulException.BadRequest("Reply target is nonexistent or inaccessible")
|
||||
: null;
|
||||
|
||||
var note = await noteSvc.CreateNoteAsync(user, visibility, request.Text, request.Cw, reply);
|
||||
|
|
Loading…
Add table
Reference in a new issue