[backend/api] Return stripped reply data in note ascendants endpoint
This commit is contained in:
parent
a37d4c141d
commit
c134e9f87c
1 changed files with 17 additions and 11 deletions
|
@ -88,17 +88,23 @@ public class NoteController(
|
|||
.FirstOrDefaultAsync() ??
|
||||
throw GracefulException.NotFound("Note not found");
|
||||
|
||||
var notes = await db.NoteAncestors(note, limit ?? 20)
|
||||
var hits = await db.NoteAncestors(note, limit ?? 20)
|
||||
.Include(p => p.User.UserProfile)
|
||||
.Include(p => p.Reply!.User.UserProfile)
|
||||
.Include(p => p.Renote!.User.UserProfile)
|
||||
.EnsureVisibleFor(user)
|
||||
.FilterHidden(user, db)
|
||||
.PrecomputeNoteContextVisibilities(user)
|
||||
.ToListAsync();
|
||||
var res = await noteRenderer.RenderMany(notes.EnforceRenoteReplyVisibility(), user,
|
||||
Filter.FilterContext.Threads);
|
||||
|
||||
return res.ToList().OrderAncestors();
|
||||
var notes = hits.EnforceRenoteReplyVisibility();
|
||||
var res = await noteRenderer.RenderMany(notes, user, Filter.FilterContext.Threads).ToListAsync();
|
||||
|
||||
// Strip redundant reply data
|
||||
foreach (var item in res.Where(p => p.Reply != null && res.Any(i => i.Id == p.Reply.Id)))
|
||||
item.Reply = null;
|
||||
|
||||
return res.OrderAncestors();
|
||||
}
|
||||
|
||||
[HttpGet("{id}/descendants")]
|
||||
|
|
Loading…
Add table
Reference in a new issue