Paginate the outbox responses. Fixes #669
#681
已合并
epsilon-phase
于 4 年前 将 7 次代码提交从 Outbox-pagination
合并至 master
评审人
请求审核
无审核者
标签
清除选中标签
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
添加标签
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
里程碑
设置里程碑
取消选中里程碑
无可选项
未选择里程碑
指派成员
指派用户
取消指派成员
未指派成员
2 名参与者
通知
到期时间
到期日期无效或超出范围。请使用 'yyyy-mm-dd' 格式。
未设置到期时间。
依赖工单
没有设置依赖项。
参考:Plume/Plume#681
在新工单中引用
这个人很懒,什么都没留下。
删除分支 'Outbox-pagination'
删除分支是永久的。此操作 无法 撤销,继续?
取消操作
确认操作
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
被合并。第一步:
从你的仓库中签出一个新的分支并测试变更。第二步:
合并变更并更新到 Forgejo 上