[backend/core] Fix remote renotes being registered without a URI

This commit is contained in:
Laura Hausmann 2024-04-24 03:32:05 +02:00
parent 36fe68ad4f
commit 58d78b568a
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 4 additions and 2 deletions

View file

@ -269,7 +269,8 @@ public class ActivityHandlerService(
throw GracefulException.UnprocessableEntity("Invalid or unsupported announce object"); throw GracefulException.UnprocessableEntity("Invalid or unsupported announce object");
var dbNote = await noteSvc.ResolveNoteAsync(note.Id, note); var dbNote = await noteSvc.ResolveNoteAsync(note.Id, note);
await noteSvc.CreateNoteAsync(resolvedActor, announce.GetVisibility(activity.Actor), renote: dbNote); await noteSvc.CreateNoteAsync(resolvedActor, announce.GetVisibility(activity.Actor), renote: dbNote,
uri: announce.Id);
return; return;
} }
case ASEmojiReact reaction: case ASEmojiReact reaction:

View file

@ -59,7 +59,7 @@ public class NoteService(
public async Task<Note> CreateNoteAsync( public async Task<Note> CreateNoteAsync(
User user, Note.NoteVisibility visibility, string? text = null, string? cw = null, Note? reply = null, User user, Note.NoteVisibility visibility, string? text = null, string? cw = null, Note? reply = null,
Note? renote = null, IReadOnlyCollection<DriveFile>? attachments = null, Poll? poll = null, Note? renote = null, IReadOnlyCollection<DriveFile>? attachments = null, Poll? poll = null,
bool localOnly = false bool localOnly = false, string? uri = null
) )
{ {
logger.LogDebug("Creating note for local user {id}", user.Id); logger.LogDebug("Creating note for local user {id}", user.Id);
@ -130,6 +130,7 @@ public class NoteService(
var note = new Note var note = new Note
{ {
Id = IdHelpers.GenerateSlowflakeId(), Id = IdHelpers.GenerateSlowflakeId(),
Uri = uri,
Text = text?.Trim(), Text = text?.Trim(),
Cw = cw?.Trim(), Cw = cw?.Trim(),
Reply = reply, Reply = reply,