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

refactor: remove listing of posts in the show discussion endpoint #4067

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

SychO9
Copy link
Member

@SychO9 SychO9 commented Oct 12, 2024

Changes proposed in this pull request:
There is a specific non-standard and unnecessary behavior that the code does (and has done since 2015), which is that the "show discussion" endpoint, also takes care of listing the posts with pagination

  • /api/discussions/101?page[offset]=0&page[limit]=20
  • /api/discussions/101?page[near]=41

This was particularly annoying to keep when we refactored the code to the new JSON:API implementation.

This PR gets rid of that, and instead loads the posts through a second request, which is what happens anyway if you are browsing the forum.

While this is an actually minor change, it is breaking in that extensions that add relationship includes to the "show discussion" endpoint like for example: posts.mentions, would need to stop doing so. That will be added to the documentation and the upgrade tool if possible.

Important

This is not to be confused with the behavior of loading all post IDs in the "show discussion" endpoint, which is used by the scroll scrubber. That is a completely different thing. i.e linkage.

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

@SychO9 SychO9 added this to the 2.0 milestone Oct 12, 2024
@SychO9 SychO9 self-assigned this Oct 12, 2024
@SychO9 SychO9 requested a review from a team as a code owner October 12, 2024 10:30
@SychO9 SychO9 merged commit b0e8f5c into 2.x Oct 16, 2024
15 of 24 checks passed
@SychO9 SychO9 deleted the sm/show-discussion-posts branch October 16, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants