Funkwhale's answers, deletions and NodeInfo are understood
Three shapes Funkwhale 2.0 sends, each of which lost something: - its Accept is named after the Follow it answers, on our origin (`…#follows/<uuid>/accept`), and was refused as off its actor's origin, so no follow of a channel completed: an Accept or Reject whose id extends the id of the activity it answers, on our origin, is now taken; - a channel deletes its uploads in one Delete without an id, their ids in a list as the object's id: each is deleted; - its NodeInfo discovery names the document under its swagger schema's URL: a link whose path names NodeInfo is taken when no rel is known. 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
3866558d1d
commit
9f0b25e92b
5 files changed
+82
-3
No files matched your search
@@ -160,6 +160,63 @@ namespace PrivaPub.Tests.Federation
|
||||
Assert.Equal(400, (await _harness.Deliver(organiser, "/human-centipede", Create(organiser, claimed))).StatusCode);
|
||||
}
|
||||
|
||||
// Funkwhale names its Accept after the Follow it answers (`<our Follow's id>/accept`), on our origin, not its own
|
||||
[Fact]
|
||||
public async Task An_answer_named_after_our_follow_is_taken_and_one_naming_someone_elses_is_not()
|
||||
{
|
||||
var token = TestContext.Current.CancellationToken;
|
||||
var (root, alice) = await _harness.Persona("alice");
|
||||
var channel = new RemoteActor(_harness.Peer, "channel");
|
||||
await _harness.Follows.Follow(root, new FollowForm { AvatarId = alice.Id, Target = channel.Id }, token);
|
||||
var following = await DB.Default.Find<Following>().Match(f => f.AvatarId == alice.Id && f.TargetActorURI == channel.Id).ExecuteSingleAsync(token);
|
||||
|
||||
var elsewhere = await _harness.Deliver(channel, "/human-centipede", new JsonObject
|
||||
{
|
||||
["id"] = "https://privapub.test/peasants/somebody/accept", ["type"] = "Accept", ["actor"] = channel.Id, ["object"] = following.FollowActivityURI
|
||||
});
|
||||
Assert.Equal(400, elsewhere.StatusCode);
|
||||
|
||||
var named = await _harness.Deliver(channel, "/human-centipede", new JsonObject
|
||||
{
|
||||
["id"] = following.FollowActivityURI + "/accept", ["type"] = "Accept", ["actor"] = channel.Id,
|
||||
["object"] = new JsonObject { ["id"] = following.FollowActivityURI, ["type"] = "Follow", ["actor"] = alice.Uri, ["object"] = channel.Id }
|
||||
});
|
||||
Assert.Equal(202, named.StatusCode);
|
||||
Assert.Equal(FollowState.Accepted, (await DB.Default.Find<Following>().OneAsync(following.ID, token)).State);
|
||||
}
|
||||
|
||||
// Funkwhale's channel deletes its uploads in one Delete, their ids in a list as the object's id (and the Delete has
|
||||
// no id of its own)
|
||||
[Fact]
|
||||
public async Task A_delete_naming_several_objects_removes_each()
|
||||
{
|
||||
var token = TestContext.Current.CancellationToken;
|
||||
var (_, alice) = await _harness.Persona("alice");
|
||||
var channel = new RemoteActor(_harness.Peer, "channel");
|
||||
await Follows(alice.Id, channel);
|
||||
var first = PublicNote(channel, "<p>a first track</p>");
|
||||
var second = PublicNote(channel, "<p>a second track</p>");
|
||||
await _harness.Deliver(channel, "/human-centipede", Create(channel, first));
|
||||
await _harness.Deliver(channel, "/human-centipede", Create(channel, second));
|
||||
Task<bool> Held(JsonObject note) => DB.Default.Find<Post>().Match(p => p.ObjectURI == IdOf(note)).ExecuteAnyAsync(token);
|
||||
Assert.True(await Held(first) && await Held(second));
|
||||
|
||||
var result = await _harness.Receiver.Receive(channel.Post(Harness.Host, "/human-centipede", new JsonObject
|
||||
{
|
||||
["type"] = "Delete", ["actor"] = channel.Id,
|
||||
["object"] = new JsonObject { ["id"] = new JsonArray(IdOf(first), IdOf(second)), ["type"] = "Audio" }
|
||||
}), default, token);
|
||||
Assert.Equal(202, result.StatusCode);
|
||||
var listed = IdOf(first);
|
||||
var job = await DB.Default.Find<PrivaPub.Models.Jobs.Job>().Match(j => j.Kind == PrivaPub.Models.Jobs.JobKind.ProcessInbox
|
||||
&& j.State == PrivaPub.Models.Jobs.JobState.Pending && j.Payload.Contains(listed)).Sort(j => j.CreatedAt, MongoDB.Entities.Order.Descending)
|
||||
.ExecuteFirstAsync(token);
|
||||
await _harness.Processor.Handle(job, token);
|
||||
|
||||
Assert.False(await Held(first));
|
||||
Assert.False(await Held(second));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task A_like_naming_a_post_by_its_page_counts_and_its_undo_too()
|
||||
{
|
||||
|
||||
@@ -59,6 +59,10 @@ namespace PrivaPub.Tests.Statistics
|
||||
|
||||
Assert.Equal(("https://a.example/2.2", "2.2"), InstanceDocuments.NodeInfoLink(links));
|
||||
Assert.Equal(default, InstanceDocuments.NodeInfoLink(Json("[]")));
|
||||
// Funkwhale 2.0 links its NodeInfo under its swagger schema's URL
|
||||
Assert.Equal(("https://f.example/api/v2/instance/nodeinfo/2.1", "2.1"), InstanceDocuments.NodeInfoLink(Json("""
|
||||
{"links":[{"rel":"https://docs.funkwhale.audio/swagger/schema.yml","href":"https://f.example/api/v2/instance/nodeinfo/2.1"}]}
|
||||
""")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in new issue
Block a user