Follow requests nobody answers are sent again
A Follow was resent only when the persona followed again. Lemmy 1.0 sends nothing it queued for a server before it started sending there, so the Accept of a community follow made on first contact was lost for good: the village's persona stayed "requested" a day while Lemmy listed her as a follower, and every post the community announced was refused as not followed. A request still unanswered is now sent again, the same activity, after 15 minutes, an hour, 6 hours, a day, two and four days (FollowResender, every 15 minutes); a server that holds the follow answers the copy. 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
7e37f56db6
commit
01808fa644
7 files changed
+103
-2
No files matched your search
@@ -42,6 +42,41 @@ namespace PrivaPub.Tests.Federation
|
||||
|
||||
PrivaPub.Models.Statistics.InteractionEvent Processed(string activity) => _harness.Ledger.Of("in").Last(e => e.Activity == activity);
|
||||
|
||||
// a follow request nobody answers is sent again after 15 minutes, an hour, 6 hours... (Lemmy 1.0 lost the Accept of a
|
||||
// follow it took before it started sending to us, and the community's posts were refused as not followed)
|
||||
[Fact]
|
||||
public async Task A_follow_request_nobody_answers_is_sent_again_with_a_growing_pause_until_it_is()
|
||||
{
|
||||
var token = TestContext.Current.CancellationToken;
|
||||
var (root, alice) = await _harness.Persona("alice");
|
||||
var quiet = new RemoteActor(_harness.Peer, "quiet");
|
||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = quiet.Id }, token);
|
||||
var following = await DB.Default.Find<Following>().Match(f => f.AvatarId == alice.Id && f.TargetActorURI == quiet.Id).ExecuteSingleAsync(token);
|
||||
async Task<int> Follows() => (await _harness.Outgoing(quiet.Id + "/inbox")).Count(a => a["type"]!.GetValue<string>() == "Follow");
|
||||
var made = following.CreatedAt;
|
||||
Assert.Equal(1, await Follows());
|
||||
|
||||
// (the store is shared with other tests' requests: what this one got is counted on its own inbox)
|
||||
async Task<int> After(TimeSpan wait)
|
||||
{
|
||||
var before = await Follows();
|
||||
await _harness.Follows.ResendPending(made + wait, token);
|
||||
return await Follows() - before;
|
||||
}
|
||||
Assert.Equal(0, await After(TimeSpan.FromMinutes(10)));
|
||||
Assert.Equal(1, await After(TimeSpan.FromMinutes(16)));
|
||||
Assert.Equal(0, await After(TimeSpan.FromMinutes(30)));
|
||||
Assert.Equal(1, await After(TimeSpan.FromMinutes(77)));
|
||||
Assert.Equal(3, await Follows());
|
||||
Assert.All(await _harness.Outgoing(quiet.Id + "/inbox"), a => Assert.Equal(following.FollowActivityURI, a["id"]!.GetValue<string>()));
|
||||
|
||||
// a request older than the count is sent again too; an answered one never
|
||||
await DB.Default.Update<Following>().MatchID(following.ID).Modify(b => b.Unset(f => f.Resent)).Modify(b => b.Unset(f => f.ResentAt)).ExecuteAsync(token);
|
||||
Assert.Equal(1, await After(TimeSpan.FromDays(1)));
|
||||
await DB.Default.Update<Following>().MatchID(following.ID).Modify(f => f.State, FollowState.Accepted).ExecuteAsync(token);
|
||||
Assert.Equal(0, await After(TimeSpan.FromDays(30)));
|
||||
}
|
||||
|
||||
// Pixelfed names our post by its page (/@name/<id>, the post's url) in its Like, Announce and their Undo: the post is
|
||||
// found the same as by its id
|
||||
[Fact]
|
||||
|
||||
Reference in new issue
Block a user