From 123ba39520577ec2883369a82a5b9654f84d50d5 Mon Sep 17 00:00:00 2001 From: thepra Date: Sun, 4 Oct 2026 03:46:48 +0200 Subject: [PATCH] A post whose author cannot be shown is left out of a list, never a 500 The v1.19.0 deploy's tests failed where build.yml's passed. A test stored a public remote post with no author id, and when the public timeline test ran after it, MastodonMapper.Statuses looked that null up in its accounts and answered 500. The mapper now skips such a post, and the test stores a real author. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01ELjqpznMFMNrJoJUj6K5p2 --- PrivaPub.Tests/Federation/GroupTests.cs | 4 +++- PrivaPub/Api/Mastodon/Mappers/MastodonMapper.cs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/PrivaPub.Tests/Federation/GroupTests.cs b/PrivaPub.Tests/Federation/GroupTests.cs index 5b1304f..ca46aa4 100644 --- a/PrivaPub.Tests/Federation/GroupTests.cs +++ b/PrivaPub.Tests/Federation/GroupTests.cs @@ -195,11 +195,13 @@ namespace PrivaPub.Tests.Federation entity.Members.Add(new GroupMember { AvatarId = bob.Id }); await DB.Default.SaveAsync(entity, token); var outsider = new RemoteActor(_harness.Peer, "asked"); - await _harness.Remote.GetActor(outsider.Id, refresh: false, token); + var outsiderAccount = await _harness.Remote.GetActor(outsider.Id, refresh: false, token); var asksFirst = new Post { ObjectURI = $"{Origin(outsider)}/notes/{Guid.NewGuid():N}", ActorURI = outsider.Id, + GroupUserId = outsiderAccount.ID, + AuthorAccountId = outsiderAccount.ID, IsFederatedCopy = true, Visibility = PostVisibility.Public, ContentHtml = "

ask me first

", diff --git a/PrivaPub/Api/Mastodon/Mappers/MastodonMapper.cs b/PrivaPub/Api/Mastodon/Mappers/MastodonMapper.cs index 036526d..479f76e 100644 --- a/PrivaPub/Api/Mastodon/Mappers/MastodonMapper.cs +++ b/PrivaPub/Api/Mastodon/Mappers/MastodonMapper.cs @@ -202,8 +202,8 @@ namespace PrivaPub.Api.Mastodon.Mappers Status Map(PostEntity post) { - if (!accounts.TryGetValue(AuthorOf(post), out var account)) - return default; + if (AuthorOf(post) is not { } author || !accounts.TryGetValue(author, out var account)) + return default;//a post whose author we cannot show is left out, never a 500 var status = new Status { Id = post.ID,