Skip to content

feat: add video-only posts filter#101

Open
AlejandroAkbal wants to merge 1 commit intomainfrom
auto-triage/214-filter-options
Open

feat: add video-only posts filter#101
AlejandroAkbal wants to merge 1 commit intomainfrom
auto-triage/214-filter-options

Conversation

@AlejandroAkbal
Copy link
Copy Markdown
Member

@AlejandroAkbal AlejandroAkbal commented Mar 14, 2026

Summary

  • add a Type filter option to the public posts search menu so users can narrow results to videos only
  • keep the filter in the posts route query and reflect it in page metadata for shareable filtered searches
  • cover filter query persistence with a router helper regression test

Validation

  • pnpm install
  • git submodule update --init --recursive
  • pnpm exec vitest run test/assets/router-helper.test.ts
  • pnpm exec nuxi typecheck (fails due to pre-existing repo-wide issues, including missing @vue/language-core and unrelated TypeScript errors)

Feedback

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new "Type" filter to the posts page, enabling users to filter by media type (photo or video)
    • Page titles and SEO descriptions now automatically reflect the active type filter selection
  • Tests

    • Added test coverage for route filter persistence

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 14, 2026

Walkthrough

The changes introduce a new "Type" media filter for posts, allowing users to filter by video or default content. The router helper function is extended to support passing filter objects through route queries, with corresponding test coverage added.

Changes

Cohort / File(s) Summary
Post Type Filter Implementation
pages/posts/[domain].vue
Added PhotoIcon import, extended selectedFilters state to include type field from route query, introduced type filter configuration with video option, implemented post filtering by media_type, and updated page title and SEO description to reflect active type filter.
Router Helper Test Update
test/assets/router-helper.test.ts
Added test case validating that generatePostsRoute preserves filter objects into route.query.filter; updated function signature to accept optional filter parameter at 5th position.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: add video-only posts filter' directly and clearly describes the main change: adding a Type filter that allows users to filter posts to show video content only.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch auto-triage/214-filter-options
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch auto-triage/214-filter-options
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pages/posts/[domain].vue (1)

98-106: ⚠️ Potential issue | 🟡 Minor

Validate and normalize filter.type from route query.

At Line [102], raw query input is used directly. Invalid/array values can silently produce no results and incorrect SEO text. Normalize to allowed values (currently video) before storing in selectedFilters.

Proposed fix
+  const allowedTypeFilters = new Set(['video'])
+
   const selectedFilters = computed(() => {
-    // TODO: Validate
+    const rawType = route.query.filter?.type
+    const type = typeof rawType === 'string' && allowedTypeFilters.has(rawType)
+      ? rawType
+      : undefined

     return {
-      type: route.query.filter?.type ?? undefined,
+      type,
       rating: route.query.filter?.rating ?? undefined,
       sort: route.query.filter?.sort ?? undefined,
       score: route.query.filter?.score ?? undefined
     }
   })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pages/posts/`[domain].vue around lines 98 - 106, selectedFilters currently
copies route.query.filter?.type directly; validate and normalize it in the
computed so invalid or array values don't leak into state/SEO. In the
selectedFilters computed (referencing selectedFilters and
route.query.filter?.type), ensure you check that filter.type is a string (not an
array), then map/allow only known values (e.g., "video") and set undefined for
anything else; return the normalized value instead of the raw query value so
only permitted types are stored.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@pages/posts/`[domain].vue:
- Around line 98-106: selectedFilters currently copies route.query.filter?.type
directly; validate and normalize it in the computed so invalid or array values
don't leak into state/SEO. In the selectedFilters computed (referencing
selectedFilters and route.query.filter?.type), ensure you check that filter.type
is a string (not an array), then map/allow only known values (e.g., "video") and
set undefined for anything else; return the normalized value instead of the raw
query value so only permitted types are stored.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8ed634f2-65b3-46c0-86ec-bb805b460212

📥 Commits

Reviewing files that changed from the base of the PR and between 5cc34fe and 1bea152.

📒 Files selected for processing (2)
  • pages/posts/[domain].vue
  • test/assets/router-helper.test.ts

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