A community announces back to its author's own server
Lemmy keeps its user's post in a community pending until the community announces it back. A community hosted here announced only to its followers, so a post from a server where nobody follows the community stayed pending there; the author's own server (its shared inbox) now gets the announces too. INTEROP records, confirmed live, why Lemmy refuses our Flags (an Application reporter, no `to`, an array object). FEDERATION.md's custom emoji line is put back before the replies paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
a3a66b6db2
commit
af2c61292b
5 files changed
+40
-8
No files matched your search
@@ -1,6 +1,7 @@
|
||||
using MongoDB.Entities;
|
||||
|
||||
using PrivaPub.Federation.Actors;
|
||||
using PrivaPub.Federation.Objects;
|
||||
using PrivaPub.Federation.Rendering;
|
||||
using PrivaPub.Models.Federation;
|
||||
|
||||
@@ -18,6 +19,16 @@ namespace PrivaPub.Federation.Outbox
|
||||
public class GroupDistributor : IGroupDistributor
|
||||
{
|
||||
// so the announce's id resolves (PeasantsController.Grunt); a repeat of the same announce keeps the first
|
||||
// a remote author's server's inbox (its shared one when it has one); none for our own personas
|
||||
static async Task<string[]> AuthorsInbox(JsonObject activity, CancellationToken token)
|
||||
{
|
||||
if (ActivityJson.Id(activity["actor"]) is not { } actorUri)
|
||||
return default;
|
||||
var author = await DB.Default.Find<Models.User.ForeignAvatar>().Match(a => a.ActorURI == actorUri).ExecuteFirstAsync(token);
|
||||
var inbox = string.IsNullOrEmpty(author?.SharedInboxURL) ? author?.InboxURL : author.SharedInboxURL;
|
||||
return string.IsNullOrEmpty(inbox) ? default : new[] { inbox };
|
||||
}
|
||||
|
||||
static async Task Keep(LocalActor group, JsonObject announce, string objectUri, CancellationToken token)
|
||||
{
|
||||
var body = (JsonObject)announce.DeepClone();
|
||||
@@ -63,16 +74,18 @@ namespace PrivaPub.Federation.Outbox
|
||||
["audience"] = group.Uri,
|
||||
["object"] = embedded
|
||||
};
|
||||
// Every follower, the author's own server included: Lemmy 1.0 keeps its user's post pending until the community
|
||||
// announces it back, and clears that before it answers the echo 400 ("Object is not remote").
|
||||
await _delivery.EnqueueToFollowers(group, announce, token);
|
||||
// Every follower, and the author's own server whether anyone there follows the community or not: Lemmy 1.0 keeps
|
||||
// its user's post pending until the community announces it back, and clears that before it answers the echo 400
|
||||
// ("Object is not remote").
|
||||
var authorsServer = await AuthorsInbox(activity, token);
|
||||
await _delivery.EnqueueToFollowers(group, announce, token, authorsServer);
|
||||
await Keep(group, announce, objectUri, token);
|
||||
// a new post or comment is also boosted as itself: microblogs (Mastodon, Akkoma, Misskey) drop an Announce of an
|
||||
// activity, so without it their members never see what is said in the community; Lemmy answers it 400, harmlessly
|
||||
if (isNewPost && !string.IsNullOrEmpty(objectUri))
|
||||
{
|
||||
var boost = ActivityPubRenderer.Announce(group, objectUri, $"announce-object-{key}");
|
||||
await _delivery.EnqueueToFollowers(group, boost, token);
|
||||
await _delivery.EnqueueToFollowers(group, boost, token, authorsServer);
|
||||
await Keep(group, boost, objectUri, token);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user