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

Fixed comments APIs incorrectly returning hidden/deleted replies #21743

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kevinansfield
Copy link
Member

ref https://linear.app/ghost/issue/PLG-270/

If the API is returning replies that are not shown in the UI then the comments-ui app isn't able to paginate correctly. This should be true across all comments endpoints with no inconsistency across browse by page or comment, or when fetching individual comments.

  • expectations for public comments endpoints:
    • hidden/deleted comments are never returned unless they have published replies
    • hidden/deleted replies are never returned
  • expectations for admin comments endpoints:
    • deleted comments are never returned unless they have published replies
    • deleted replies are never returned
    • hidden comments+replies are always returned (necessary to allow hidden comments to be toggled back to visible)

kevinansfield and others added 3 commits November 27, 2024 15:59
ref https://linear.app/ghost/issue/PLG-270/

- added details API tests for members-comments and admin-comments API endpoints
- expectations for public comments endpoints:
  - hidden/deleted comments are never returned unless they have published replies
  - hidden/deleted replies are never returned
- expectations for admin comments endpoints:
  - deleted comments are never returned unless they have published replies
  - deleted replies are never returned
  - hidden comments+replies are always returned (necessary to allow hidden comments to be toggled back to visible)
…lies

ref https://linear.app/ghost/issue/PLG-270/

- bookshelf's `.load()` method allows us to pass in an object containing a query builder callback for each relationship. By using that inside of `Comment.findPage()` we're able to apply a `WHERE` query to the replies relationship fetches, allowing us to adjust the filtering depending on whether the query is coming from a public vs an admin endpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants