Skip to content

Reworked comment moderation filters on the shared filter core#26829

Closed
jonatansberg wants to merge 4 commits intomainfrom
ber-3414-comments-filters
Closed

Reworked comment moderation filters on the shared filter core#26829
jonatansberg wants to merge 4 commits intomainfrom
ber-3414-comments-filters

Conversation

@jonatansberg
Copy link
Copy Markdown
Member

@jonatansberg jonatansberg commented Mar 16, 2026

Summary

  • moved the comments moderation filter state, field definitions, query translation, and hydration onto the shared filter core introduced in Reworked member filters on a shared filter core #26828
  • replaced the inline comments filter wiring with comment-specific field definitions, query helpers, and a dedicated state hook
  • added focused tests for comment field definitions, comment query translation, and comment filter state

Why this change

The comments moderation screen was still carrying its own filter wiring after the members rewrite established the shared filter core. This follow-up adopts the same core for comments so both surfaces use the same abstractions for field resolution, codecs, and NQL compilation.

Dependency

What changed

  • added comment field definitions and query translation for the current comments moderation filters
  • added a comments-specific filter state hook and hydration hook for building runtime field configs
  • updated the comments moderation UI to use the new filter state/query path
  • kept the comments-specific behavior explicit where the backend contract still requires it, including reported-state handling and exact-date parsing

Test plan

  • yarn --cwd apps/posts tsc --noEmit
  • yarn --cwd apps/posts lint
  • yarn --cwd apps/posts vitest run src/views/filters/filter-query-core.test.ts src/views/filters/filter-ast.test.ts src/views/filters/filter-codecs.test.ts src/views/filters/filter-operator-options.test.ts src/views/filters/filter-normalization.test.ts src/views/filters/filter-types.test.ts src/views/filters/resolve-field.test.ts src/views/comments/comment-fields.test.ts src/views/comments/comment-filter-query.test.ts src/views/comments/use-comment-filter-fields.test.ts src/views/comments/hooks/use-filter-state.test.tsx

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 16, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f61f35c1-655a-4a7b-aed3-7120888ef821

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ber-3414-comments-filters

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

E2E Tests Failed

To view the Playwright test report locally, run:

REPORT_DIR=$(mktemp -d) && gh run download 23148752181 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR"

@jonatansberg jonatansberg force-pushed the ber-3414-rework-filters-for-members-only branch from 02ae53b to 75a96b6 Compare March 17, 2026 09:55
@jonatansberg jonatansberg force-pushed the ber-3414-comments-filters branch from 1c9e96e to c0f30a5 Compare March 17, 2026 09:55
@jonatansberg jonatansberg force-pushed the ber-3414-rework-filters-for-members-only branch from e3e5e1f to 48ebfcf Compare March 17, 2026 16:06
@jonatansberg jonatansberg force-pushed the ber-3414-comments-filters branch from 5fd16e2 to e40a95d Compare March 17, 2026 16:06
@jonatansberg jonatansberg force-pushed the ber-3414-rework-filters-for-members-only branch from 8017c07 to 929e525 Compare March 18, 2026 14:16
@jonatansberg jonatansberg force-pushed the ber-3414-comments-filters branch from e40a95d to 588e8f7 Compare March 18, 2026 14:16
@github-actions
Copy link
Copy Markdown
Contributor

E2E Tests Failed

To view the Playwright test report locally, run:

REPORT_DIR=$(mktemp -d) && gh run download 23249176988 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR"

Base automatically changed from ber-3414-rework-filters-for-members-only to main March 19, 2026 12:17
ref https://linear.app/ghost/issue/BER-3414

Reapplied the comments filter/query/hydration rewrite on top of the cleaned members-first base branch so the shared filter core can be reviewed once and the comments rollout can land separately.
ref https://linear.app/ghost/issue/BER-3414

Applied the CI-flagged class-order fixes for the newsletter analytics and comments moderation files on the stacked comments branch.
ref https://linear.app/ghost/issue/BER-3414
Backported the shared date and operator helpers needed by the restored comment filter UI and aligned the comment state hook with the router import pattern used elsewhere in Posts.
@jonatansberg jonatansberg force-pushed the ber-3414-comments-filters branch from 588e8f7 to ace7495 Compare March 24, 2026 08:47
@github-actions
Copy link
Copy Markdown
Contributor

E2E Tests Failed

To view the Playwright test report locally, run:

REPORT_DIR=$(mktemp -d) && gh run download 23480774642 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR"

ref https://linear.app/ghost/issue/BER-3414
The comments moderation rewrite now reads canonical filter params, but existing id=is: deep links still need to load the single-comment moderation view used by the E2E suite.
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.

1 participant