Skip to content

Commit

Permalink
Added handling for Group announced Create activities (#210)
Browse files Browse the repository at this point in the history
refs [AP-608](https://linear.app/ghost/issue/AP-608/ghost-does-not-work-with-lemmy-or-wordpress)

Added handling for `Group` announced `Create` activities so that these activities
are recorded processed by the service. Activities are usually only announced as
part of Group federation
  • Loading branch information
mike182uk authored Nov 28, 2024
1 parent fa8d030 commit 08502b7
Show file tree
Hide file tree
Showing 11 changed files with 292 additions and 44 deletions.
4 changes: 2 additions & 2 deletions features/accept-follows.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: We automatically accept Follow requests

Scenario: We can be followed
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given a "Follow(Us)" Activity "F" by "Alice"
When "Alice" sends "F" to the Inbox
And "F" is in our Inbox
Expand All @@ -12,7 +12,7 @@ Feature: We automatically accept Follow requests
Rule: We can be followed multiple times by the same actor, but we only record them once

Example: An actor attempts to follow us multiple times
Given an Actor "Alice"
Given an Actor "Person(Alice)"
And a "Follow(Us)" Activity "F1" by "Alice"
And a "Follow(Us)" Activity "F2" by "Alice"
When "Alice" sends "F1" to the Inbox
Expand Down
4 changes: 2 additions & 2 deletions features/create-note.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Feature: Creating a note
And "Note" has the content "<p>Hello<br />World</p>"

Scenario: Created note is sent to followers
Given an Actor "Alice"
And an Actor "Bob"
Given an Actor "Person(Alice)"
And an Actor "Person(Bob)"
And a "Follow(Us)" Activity "F1" by "Alice"
And a "Follow(Us)" Activity "F2" by "Bob"
And "Alice" sends "F1" to the Inbox
Expand Down
2 changes: 1 addition & 1 deletion features/follow-account.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Follow accounts from their handle

Scenario: We can follow an account only once
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given we follow "Alice"
Then the request is accepted
Given a "Accept(Follow(Alice))" Activity "A" by "Alice"
Expand Down
4 changes: 2 additions & 2 deletions features/handle-announce.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Announce(Note)
We want to handle Announce(Note) activities in the Inbox

Scenario: We recieve a Announce(Note) activity from someone we follow
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given we follow "Alice"
Then the request is accepted
Given a "Accept(Follow(Alice))" Activity "Accept" by "Alice"
Expand All @@ -14,7 +14,7 @@ Feature: Announce(Note)
Then "A" is in our Inbox

Scenario: We recieve a Announce(Note) activity from someone we don't follow
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given a "Announce(Note)" Activity "A" by "Alice"
When "Alice" sends "A" to the Inbox
Then the request is accepted
Expand Down
4 changes: 2 additions & 2 deletions features/handle-create-article.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Create(Article)
We want to handle Create(Article) activities in the Inbox

Scenario: We recieve a Create(Article) activity from someone we follow
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given we follow "Alice"
Then the request is accepted
Given a "Accept(Follow(Alice))" Activity "Accept" by "Alice"
Expand All @@ -14,7 +14,7 @@ Feature: Create(Article)
Then "A" is in our Inbox

Scenario: We recieve a Create(Article) activity from someone we don't follow
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given a "Create(Article)" Activity "A" by "Alice"
When "Alice" sends "A" to the Inbox
Then the request is accepted
Expand Down
26 changes: 26 additions & 0 deletions features/handle-group-announce.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Feature: Handling activities announced by a Group
Background:
Given an Actor "Person(Alice)"
And an Actor "Group(Wonderland)"
And we follow "Wonderland"
And the request is accepted
And a "Accept(Follow(Wonderland))" Activity "Accept" by "Wonderland"
And "Wonderland" sends "Accept" to the Inbox
And "Accept" is in our Inbox

Scenario: We recieve a Create(Article) activity announced by a Group
Given a "Create(Article)" Activity "Create" by "Alice"
And a "Announce(Create)" Activity "Announce" by "Wonderland"
When "Wonderland" sends "Announce" to the Inbox
Then "Create" is in our Inbox
And "Announce" is not in our Inbox

Scenario: We recieve a Create(Article) activity with a tampered object announced by a Group
Given an Actor "Person(Bob)"
And a "Note" Object "Spam" by "Bob"
And a "Article" Object "Article" by "Alice"
And a "Create(Article)" Activity "Create" by "Alice"
And "Create" has Object "Spam"
And a "Announce(Create)" Activity "Announce" by "Wonderland"
When "Wonderland" sends "Announce" to the Inbox
Then "Create" is in our Inbox with Object "Article"
4 changes: 2 additions & 2 deletions features/handle-like.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Feature: Like(Article)
We want to handle Like(Article) activities in the Inbox

Scenario: We recieve a Like(Article) activity from someone
Given an Actor "Alice"
And an Actor "Bob"
Given an Actor "Person(Alice)"
And an Actor "Person(Bob)"
And a "Create(Article)" Activity "A" by "Alice"
And a "Like(A)" Activity "L" by "Bob"
When "Bob" sends "L" to the Inbox
Expand Down
2 changes: 1 addition & 1 deletion features/handle-replies.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Create(Note<inReplyTo>)

Given the found "Create(Article)" as "ArticleCreate(OurArticle)"

Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given a "Note" Object "Reply" by "Alice"
And "Reply" is a reply to "OurArticle"
And a "Create(Reply)" Activity "A" by "Alice"
Expand Down
8 changes: 4 additions & 4 deletions features/like-activity.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Feature: Liking an object
So that I can express my approval of the content

Scenario: Liking an object that has not been liked before
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given we follow "Alice"
Then the request is accepted
Given a "Accept(Follow(Alice))" Activity "Accept" by "Alice"
Expand All @@ -20,7 +20,7 @@ Feature: Liking an object
And a "Like(Note)" activity is sent to "Alice"

Scenario: Liking an object that has been liked before
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given we follow "Alice"
Then the request is accepted
Given a "Accept(Follow(Alice))" Activity "Accept" by "Alice"
Expand All @@ -35,7 +35,7 @@ Feature: Liking an object
Then the request is rejected with a 409

Scenario: Unliking an object that has not been liked before
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given we follow "Alice"
Then the request is accepted
Given a "Accept(Follow(Alice))" Activity "Accept" by "Alice"
Expand All @@ -48,7 +48,7 @@ Feature: Liking an object
Then the request is rejected with a 409

Scenario: Unliking an object that has been liked before
Given an Actor "Alice"
Given an Actor "Person(Alice)"
Given we follow "Alice"
Then the request is accepted
Given a "Accept(Follow(Alice))" Activity "Accept" by "Alice"
Expand Down
Loading

0 comments on commit 08502b7

Please sign in to comment.