[backend/federation] Fetch threads with user keypair as well

This commit is contained in:
Laura Hausmann 2024-02-24 23:45:18 +01:00
parent 2c33f7aafc
commit da63c26887
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -294,7 +294,7 @@ public class NoteService(
eventSvc.RaiseNoteDeleted(this, hit); eventSvc.RaiseNoteDeleted(this, hit);
} }
public async Task<Note> ProcessNoteAsync(ASNote note, User actor) public async Task<Note> ProcessNoteAsync(ASNote note, User actor, User? user = null)
{ {
var dbHit = await db.Notes.IncludeCommonProperties().FirstOrDefaultAsync(p => p.Uri == note.Id); var dbHit = await db.Notes.IncludeCommonProperties().FirstOrDefaultAsync(p => p.Uri == note.Id);
@ -345,8 +345,8 @@ public class NoteService(
CreatedAt = createdAt, CreatedAt = createdAt,
UserHost = actor.Host, UserHost = actor.Host,
Visibility = note.GetVisibility(actor), Visibility = note.GetVisibility(actor),
Reply = note.InReplyTo?.Id != null ? await ResolveNoteAsync(note.InReplyTo.Id) : null, Reply = note.InReplyTo?.Id != null ? await ResolveNoteAsync(note.InReplyTo.Id, user: user) : null,
Renote = quoteUrl != null ? await ResolveNoteAsync(quoteUrl) : null Renote = quoteUrl != null ? await ResolveNoteAsync(quoteUrl, user: user) : null
}; };
if (dbNote.Renote?.IsPureRenote ?? false) if (dbNote.Renote?.IsPureRenote ?? false)
@ -626,7 +626,7 @@ public class NoteService(
try try
{ {
return await ProcessNoteAsync(fetchedNote, actor); return await ProcessNoteAsync(fetchedNote, actor, user);
} }
catch (Exception e) catch (Exception e)
{ {