Paginate the outbox responses. Fixes #669
#681
병합
epsilon-phase
Outbox-pagination
에서 master
로 7 commits 를 머지했습니다 5 년 전
리뷰어
Request review
No reviewers
레이블
레이블 초기화
Related to the REST API
Code running on the server
Stuff related to Federation
Related to the front-end
Translations, and related code
More about project management or code than the project itself
The building, or installation process of Plume
Something isn't working
We need to talk
New feature or request
This is a new feature
Compatibility with different browsers, readers and OS
Related to an external package that Plume uses
UI/UX related issues and PRs
Good for newcomers
Extra attention is needed
Issues affecting only mobile UX
How elements're rendered out for the end user
Something else needs to be fixed first
This issue or pull request already exists
This PR is not complete yet
Issues concern a limited number of instances
This doesn't seem right
Need to be discussed by the community (on Loomio)
This PR is ready to be reviewed
Proposed ideas worth considering
This is issue has been created after a vote on Loomio
This will not be worked on
Apply labels
A: API
Related to the REST API
A: Backend
Code running on the server
A: Federation
Stuff related to Federation
A: Front-End
Related to the front-end
A: I18N
Translations, and related code
A: Meta
More about project management or code than the project itself
A: Security
Build
The building, or installation process of Plume
C: Bug
Something isn't working
C: Discussion
We need to talk
C: Enhancement
New feature or request
C: Feature
This is a new feature
Compatibility
Compatibility with different browsers, readers and OS
Dependency
Related to an external package that Plume uses
Design
UI/UX related issues and PRs
Documentation
Good first issue
Good for newcomers
Help welcome
Extra attention is needed
Mobile
Issues affecting only mobile UX
Rendering
How elements're rendered out for the end user
S: Blocked
Something else needs to be fixed first
S: Duplicate
This issue or pull request already exists
S: Incomplete
This PR is not complete yet
S: Instance specific
Issues concern a limited number of instances
S: Invalid
This doesn't seem right
S: Needs Voting/Discussion
Need to be discussed by the community (on Loomio)
S: Ready for review
This PR is ready to be reviewed
Suggestion
Proposed ideas worth considering
S: Voted on Loomio
This is issue has been created after a vote on Loomio
S: Wontfix
This will not be worked on
레이블 없음
A: API
A: Backend
A: Federation
A: Front-End
A: I18N
A: Meta
A: Security
Build
C: Bug
C: Discussion
C: Enhancement
C: Feature
Compatibility
Dependency
Design
Documentation
Good first issue
Help welcome
Mobile
Rendering
S: Blocked
S: Duplicate
S: Incomplete
S: Instance specific
S: Invalid
S: Needs Voting/Discussion
S: Ready for review
Suggestion
S: Voted on Loomio
S: Wontfix
마일스톤
Set milestone
마일스톤 초기화
No items
마일스톤 없음
담당자
Assign users
담당자 초기화
담당자 없음
참여자 2명
알림
마감일
기한이 올바르지 않거나 범위를 벗어났습니다. 'yyyy-mm-dd'형식을 사용해주십시오.
마감일이 설정되지 않았습니다.
의존성
No dependencies set.
Reference: Plume/Plume#681
Reference in New Issue
아직 콘텐츠가 없습니다.
'Outbox-pagination' 브랜치 삭제
Deleting a branch is permanent. It CANNOT be undone. Continue?
아니오
예
This seems to work on our end, so let us know if there's anything else that needs fixing.
Codecov Report
Thanks for participating to Plume dev!
There seems to be a few issues with you patch:
OrderedCollectionPage
instead/in addition toOrderedCollection
For ActivityPub, you need to have both an
OrderedCollection
on/@/USER/outbox
, with afirst
field, containing a link to the first page of the outbox, and an endpoint like/@/USER/outbox/page=PAGE
serving a specificOrderedCollectionPage
, that should have theitems
(an array of activities),prev
(a link to the previous page, if any) andnext
(a link to the next page, if any) fields.I don't know if that's clear, I can try to explain it in another way if you want.
That's a good start for sure then.
So it does need to also request that the most recent posts are retrieved in an earlier page too right?
Okay, so, we think we understand what we need to do, but we're not sure what the proper kind of
Link
object is for this.With any luck that does it
❓
12 is hard coded. for now.?
@ -557,2 +566,4 @@
user.outbox_page(&*rockets.conn, page.limits()).ok()
}
#[post("/@/<name>/inbox", data = "<data>")]
pub fn inbox(
does a blog also have such an outbox that could benefit from such a pagination?
Oh, we didn't know about the constant elsewhere... But it's in the routes code rather than the models code.
We'll move it over then.
@ -557,2 +566,4 @@
user.outbox_page(&*rockets.conn, page.limits()).ok()
}
#[post("/@/<name>/inbox", data = "<data>")]
pub fn inbox(
True enough, we'll get that made then....
... get_activities is a method stub for blogs. Huh.
In any case, we'll write the method stubs for now and see what's up with that.
overall this seems good, but I think there are some issues with page numbers at some places
I think this does not give the right result, divisions are flooring where in this case we need them ceiling. An easy way to achive that is to add ITEMS_PER_PAGE-1 before dividing
why is it commented? It should probably either stay or be deleted
Previous page should not be added if we are already on the first page, and a next page should probable not be added either if
get_activities_page
returned less entries than it could have.Also I think there is an out-of-one on the page index, if we are on page n°1 (that is the first with current implementation of
outbox
above), min is going to be 0, so next page will be 0/12+1 = n°1 again, and previous would be n°-1That makes sense. Should be fixed now
Alright, that makes sense too.
That makes sense.
the part about not including previous/next when unnecessary is fixed, but I don't think you addressed the other half about page index
Globally, what you have done so far seems to work well. I left a few comments.
The only thing that really needs to be fixed is that fetching old posts for a remote user is no longer working.
It starts at 1 for users, but 0 for blogs. Either are fine, but it would be better if it was consistent.
Could you please call
Blog::outbox_page
here, even if it doesn't do anything yet?Sure thing.
Looks like it should be one given the current
Page
code.Let's make it that then.
@AnaGelez You wouldn't have any recommendations on fixing the retrieval of older messages would you?
The method that needs changing is this one: https://github.com/Plume-org/Plume/blob/master/plume-models/src/users.rs#L333
It should be modified so that it fetches all the pages, and puts all the activities in the returned
Vec
.There is an issue with the
last
/first
/prev
/next
links: thehttps://
part is doubled (for instance I havehttps://https://plume.one/@/admin_one/outbox?page=1
).I think it is because
User::outbox_url
already includeshttps://
, and thus the call toap_url
is superfluous, you can useformat!
directly.That's a silly mistake to have made. Should be fixed now.
OK, it now fetches the pages correctly, but it loops infinitely, because on the last page
last
point the current page (which, indeed, is the last).It seems to work fine now! Thank you very much for your help (and your patience) 😊
리뷰어
52d860d402
.Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Forgejo.