Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paginated inbox #163

Closed
fauno opened this issue Mar 12, 2024 · 9 comments · Fixed by hyphacoop/social.distributed.press#63
Closed

Paginated inbox #163

fauno opened this issue Mar 12, 2024 · 9 comments · Fixed by hyphacoop/social.distributed.press#63
Assignees
Labels
enhancement New feature or request

Comments

@fauno
Copy link
Collaborator

fauno commented Mar 12, 2024

Nula and/or Agus to work on this. They should do an estimate for this task and let us know, so we an put it in the roadmap

Just an idea we can discuss later. I don't remember now if the inbox could be paginated, but if it is, the first page could always be pending activities and later pages activities that have been approved (and can be rejected at any time)

@fauno fauno added the enhancement New feature or request label Mar 12, 2024
@RangerMauve
Copy link
Contributor

Yeah also depends on #152

@fauno
Copy link
Collaborator Author

fauno commented Apr 15, 2024

Pagination is important because if the JSONLD object grows too much we'll hit response limits. If we keep pending activities on the first page you could be DDOSed by just receiving too many activities. Maybe always paginate and have another collection for pending activities, so it's also explicit.

@sutty-coop sutty-coop self-assigned this May 2, 2024
@RangerMauve
Copy link
Contributor

  • modify the activtystore
  • add a new sublevel for indexes
  • add a new sublevel on the indexes for published
  • when adding a new actvity, use the published time+the id as the key and the id as the value
  • when deleting an activity generate the publish key and delete it from the sublevel in addition to deleting the activity
  • modify list to iterate from the published sublevel and get activities by id
  • add skip, limit, and sort fields to list
  • add skip limit and sort fields to the outbox querystring
  • by default don't have the items in the outbox but instead link to a next page with the skip set to 0 and a limit set to some default (e.g. 128)
  • when rendering a page, have a prev field which reduces the skip field by the limit
  • we should add a count to the activitystore which fetches the total size from the activities collection, and add the total items field

@RangerMauve RangerMauve changed the title Paginated inbox? Paginated inbox May 2, 2024
@fauno
Copy link
Collaborator Author

fauno commented May 2, 2024

@RangerMauve does this mean we can paginate the inbox via url params? also for fetching approved or pending separately?

@RangerMauve
Copy link
Contributor

We don't have approved or not tracked yet but we could add that as a next step for indexing if that'd help.

@sutty-coop sutty-coop transferred this issue from hyphacoop/social.distributed.press May 3, 2024
@sutty-coop sutty-coop removed their assignment May 6, 2024
@catdevnull
Copy link
Collaborator

hey @RangerMauve, i'm not fully understanding this part:

when deleting an activity generate the publish key and delete it from the sublevel in addition to deleting the activity

what does it mean to delete an activity? in general, can you reexplain this point?

@RangerMauve
Copy link
Contributor

Ah by "deleting an activity" I just meant to add some code inside ActvityStore#remove here: https://github.com/hyphacoop/social.distributed.press/blob/main/src/server/store/ActivityStore.ts#L25

In addition to deleting the activity from the store we also need to clean up any indexes referencing it.

@RangerMauve
Copy link
Contributor

Generally whenever you add any data to a store you should have an api for removing the data from it.

@sutty-coop
Copy link
Collaborator

We need to add tests - @RangerMauve could take this on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants