Paginate the outbox responses. Fixes #669
#681
Unito
epsilon-phase
ha unito 7 commit da Outbox-pagination
a master
4 anni fa
Revisori
Richiedi revisione
Nessun revisore
Etichette
Pulisci le etichette
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
Applica etichette
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
Nessuna etichetta
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
Traguardo
Imposta traguardo
Milestone pulita
Nessun elemento
Nessuna milestone
Assegnatari
Assegna utenti
Cancella assegnatari
Nessuna assegnatario
2 Partecipanti
Notifiche
Data di scadenza
La data di scadenza non è valida o fuori intervallo. Si prega di utilizzare il formato 'aaaa-mm-dd'.
Nessuna data di scadenza impostata.
Dipendenze
Nessuna dipendenza impostata.
Riferimento: Plume/Plume#681
Fai riferimento in un nuovo problema
Non ci sono ancora contenuti.
Elimina branch 'Outbox-pagination'
L'eliminazione di un branch è definitiva. È un'operazione che NON PUÒ essere annullata. Continuare?
No
Sì
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) 😊
Revisori
52d860d402
.Passo 1:
Dal repository del tuo progetto, fai il check out di un nuovo branch e verifica le modifiche.Passo 2:
Fai il merge delle modifiche e aggiorna su Forgejo.