diff --git a/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs b/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs index c6cb91c5..422d7a46 100644 --- a/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs +++ b/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs @@ -52,27 +52,28 @@ public class ActivityPubController( [HttpGet("/notes/{id}/activity")] [AuthorizedFetch] - [OverrideResultType] + [OverrideResultType] [ProducesResults(HttpStatusCode.OK)] [ProducesErrors(HttpStatusCode.NotFound)] - public async Task GetRenote(string id) + public async Task GetNoteActivity(string id) { var actor = HttpContext.GetActor(); var note = await db.Notes .IncludeCommonProperties() .EnsureVisibleFor(actor) - .Where(p => p.Id == id && p.UserHost == null && p.IsPureRenote && p.Renote != null) + .Where(p => p.Id == id && p.UserHost == null) .FirstOrDefaultAsync() ?? throw GracefulException.NotFound("Note not found"); - return ActivityPub.ActivityRenderer - .RenderAnnounce(noteRenderer.RenderLite(note.Renote!), - note.GetPublicUri(config.Value), - userRenderer.RenderLite(note.User), - note.Visibility, - note.User.GetPublicUri(config.Value) + "/followers") - .Compact(); + var noteActor = userRenderer.RenderLite(note.User); + ASActivity activity = note is { IsPureRenote: true, Renote: not null } + ? ActivityPub.ActivityRenderer.RenderAnnounce(noteRenderer.RenderLite(note.Renote), + note.GetPublicUri(config.Value), noteActor, note.Visibility, + note.User.GetPublicUri(config.Value) + "/followers") + : ActivityPub.ActivityRenderer.RenderCreate(await noteRenderer.RenderAsync(note), noteActor); + + return activity.Compact(); } [HttpGet("/notes/{id}/replies")] diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityRenderer.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityRenderer.cs index 1c7e3c55..bb6509be 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityRenderer.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityRenderer.cs @@ -19,7 +19,7 @@ public class ActivityRenderer( public static ASCreate RenderCreate(ASNote obj, ASObject actor) => new() { - Id = $"{obj.Id}#Create", + Id = $"{obj.Id}/activity", Actor = ASActor.FromObject(actor), Object = obj, To = obj.To, @@ -239,4 +239,4 @@ public class ActivityRenderer( PublishedAt = bite.CreatedAt, To = userRenderer.RenderLite(fallbackTo) }; -} \ No newline at end of file +}