-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated feed endpoint implementation (#307)
refs https://linear.app/ghost/issue/AP-704 Updated the feed endpoint implementation to handle some edge cases discovered when updating the client to utilise the endpoint and moves towards a separate endpoint for feed and inbox, so that the implementation is not in the client. Co-authored-by: Fabien O'Carroll <fabien@allou.is>
- Loading branch information
Showing
11 changed files
with
635 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
Feature: Feed | ||
In order to see posts from accounts I follow | ||
As a user | ||
I want to query my feed | ||
|
||
Background: | ||
Given an Actor "Person(Alice)" | ||
And we follow "Alice" | ||
And the request is accepted | ||
And a "Accept(Follow(Alice))" Activity "Accept" by "Alice" | ||
And "Alice" sends "Accept" to the Inbox | ||
And "Accept" is in our Inbox | ||
|
||
Scenario: Querying the inbox | ||
Given a "Create(Article)" Activity "Article1" by "Alice" | ||
And "Alice" sends "Article1" to the Inbox | ||
And "Article1" is in our Inbox | ||
And a "Create(Note)" Activity "Note1" by "Alice" | ||
And "Alice" sends "Note1" to the Inbox | ||
And "Note1" is in our Inbox | ||
When an authenticated request is made to "/.ghost/activitypub/inbox" | ||
Then the request is accepted | ||
And the feed contains "Article1" | ||
And the feed does not contain "Note1" | ||
|
||
Scenario: Querying the feed filtered by type: Note | ||
Given a "Create(Note)" Activity "Note1" by "Alice" | ||
And "Alice" sends "Note1" to the Inbox | ||
And "Note1" is in our Inbox | ||
And a "Create(Article)" Activity "Article1" by "Alice" | ||
And "Alice" sends "Article1" to the Inbox | ||
And "Article1" is in our Inbox | ||
When an authenticated request is made to "/.ghost/activitypub/feed" | ||
Then the request is accepted | ||
And the feed contains "Note1" | ||
And the feed does not contain "Article1" | ||
|
||
Scenario: Feed only includes posts | ||
Given a "Create(Note)" Activity "Note1" by "Alice" | ||
And "Alice" sends "Note1" to the Inbox | ||
And "Note1" is in our Inbox | ||
And a "Create(Article)" Activity "Article1" by "Alice" | ||
And "Alice" sends "Article1" to the Inbox | ||
And "Article1" is in our Inbox | ||
And a "Like(Note1)" Activity "Like1" by "Alice" | ||
And "Alice" sends "Like1" to the Inbox | ||
And "Like1" is in our Inbox | ||
When an authenticated request is made to "/.ghost/activitypub/feed" | ||
Then the request is accepted | ||
And the feed contains "Note1" | ||
And the feed does not contain "Like1" | ||
When an authenticated request is made to "/.ghost/activitypub/inbox" | ||
Then the request is accepted | ||
And the feed contains "Article1" | ||
And the feed does not contain "Like1" | ||
|
||
Scenario: Feed is paginated | ||
Given a "Create(Note)" Activity "Note1" by "Alice" | ||
And "Alice" sends "Note1" to the Inbox | ||
And "Note1" is in our Inbox | ||
And a "Create(Note)" Activity "Note2" by "Alice" | ||
And "Alice" sends "Note2" to the Inbox | ||
And "Note2" is in our Inbox | ||
And a "Create(Note)" Activity "Note3" by "Alice" | ||
And "Alice" sends "Note3" to the Inbox | ||
And "Note3" is in our Inbox | ||
When an authenticated request is made to "/.ghost/activitypub/feed?limit=2" | ||
Then the request is accepted | ||
And the feed contains "Note3" | ||
And the feed contains "Note2" | ||
And the feed does not contain "Note1" | ||
And the feed has a next cursor | ||
When an authenticated request is made to "/.ghost/activitypub/feed?limit=3" | ||
Then the request is accepted | ||
And the feed contains "Note1" | ||
|
||
Scenario: Requests with limit over 100 are rejected | ||
When an authenticated request is made to "/.ghost/activitypub/feed?limit=200" | ||
Then the request is rejected with a 400 | ||
|
||
Scenario: Feed includes our own posts | ||
When we create a note "Note1" with the content | ||
""" | ||
Hello World | ||
""" | ||
When an authenticated request is made to "/.ghost/activitypub/feed" | ||
Then the request is accepted | ||
And the feed contains "Note1" | ||
|
||
Scenario: Feed includes posts we reposted | ||
Given a "Create(Note)" Activity "Note1" by "Alice" | ||
And "Alice" sends "Note1" to the Inbox | ||
And "Note1" is in our Inbox | ||
And we repost the object "Note1" | ||
And the request is accepted | ||
When an authenticated request is made to "/.ghost/activitypub/feed" | ||
Then the request is accepted | ||
And the feed contains "Note1" | ||
|
||
Scenario: Feed includes posts from followed accounts | ||
Given a "Create(Note)" Activity "Note1" by "Alice" | ||
And "Alice" sends "Note1" to the Inbox | ||
And "Note1" is in our Inbox | ||
When an authenticated request is made to "/.ghost/activitypub/feed" | ||
Then the request is accepted | ||
And the feed contains "Note1" | ||
|
||
Scenario: Feed includes reposts from followed accounts | ||
Given an Actor "Person(Bob)" | ||
And a "Note" Object "Note1" by "Bob" | ||
And a "Announce(Note1)" Activity "Repost1" by "Alice" | ||
And "Alice" sends "Repost1" to the Inbox | ||
And "Repost1" is in our Inbox | ||
When an authenticated request is made to "/.ghost/activitypub/feed" | ||
Then the request is accepted | ||
And the feed contains "Note1" | ||
|
||
Scenario: Feed excludes replies | ||
Given a "Create(Note)" Activity "Note1" by "Alice" | ||
And "Alice" sends "Note1" to the Inbox | ||
And "Note1" is in our Inbox | ||
And a "Note" Object "Reply1" by "Alice" | ||
And "Reply1" is a reply to "Note1" | ||
And a "Create(Reply1)" Activity "ReplyCreate" by "Alice" | ||
And "Alice" sends "ReplyCreate" to the Inbox | ||
And "ReplyCreate" is in our Inbox | ||
When an authenticated request is made to "/.ghost/activitypub/feed" | ||
Then the request is accepted | ||
And the feed contains "Note1" | ||
And the feed does not contain "ReplyCreate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.