Skip to content

fix: only show unlisted project chip when it's the main project#4690

Open
SylvainChevalier wants to merge 1 commit into
mainfrom
claude/issue-4687-only-show-unlisted-project-chip
Open

fix: only show unlisted project chip when it's the main project#4690
SylvainChevalier wants to merge 1 commit into
mainfrom
claude/issue-4687-only-show-unlisted-project-chip

Conversation

@SylvainChevalier
Copy link
Copy Markdown
Contributor

@SylvainChevalier SylvainChevalier commented May 5, 2026

Closes #4687

Summary

Hides unlisted project chips in the question page sidebar when the unlisted project is a secondary project. Unlisted projects are still shown when they are the question's main (default) project.

Implementation

Added a filter in sidebar_question_projects.tsx that drops any project with visibility === ProjectVisibility.Unlisted unless its id matches default_project.id.

Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Updated project filtering in the sidebar to properly hide unlisted projects, with the exception of your default project which remains visible.

Review Change Stack

Closes #4687

Co-authored-by: Sylvain <SylvainChevalier@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c36b69e3-258e-46b0-823b-2db86db5dce7

📥 Commits

Reviewing files that changed from the base of the PR and between 4441c94 and 35a7b0f.

📒 Files selected for processing (1)
  • front_end/src/app/(main)/questions/[id]/components/sidebar/sidebar_question_projects.tsx

📝 Walkthrough

Walkthrough

The sidebar component now filters project chips based on visibility. ProjectVisibility is imported, the default project is extracted from data, and the project list construction merges multiple sources while excluding Unlisted visibility projects unless they are the question's default project.

Changes

Project Visibility Filtering in Sidebar

Layer / File(s) Summary
Project visibility filtering with default project exception
front_end/src/app/(main)/questions/[id]/components/sidebar/sidebar_question_projects.tsx
Import ProjectVisibility type, destructure default_project from projectsData, and rework allProjects to merge project sources and filter out Unlisted projects except when they match the default project id.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Metaculus/metaculus#3935: Both PRs filter which project chips appear by merging project lists and applying visibility-based rules, with the sidebar excluding Unlisted except for default projects while notebooks include private project chips.

Poem

🐰 A sidebar chip shows projects bright,
But unlisted ones stay out of sight—
Unless they're default, then they gleam,
Visibility filters make the sidebar clean! ✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: filtering unlisted projects to show only when they are the default project.
Linked Issues check ✅ Passed The implementation directly addresses issue #4687 by filtering out unlisted projects unless they match the default_project id.
Out of Scope Changes check ✅ Passed All changes are scoped to the sidebar project display logic and directly relate to hiding unlisted secondary projects.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-4687-only-show-unlisted-project-chip

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

github-actions Bot commented May 5, 2026

🚀 Preview Environment

Your preview environment is ready!

Resource Details
🌐 Preview URL https://metaculus-pr-4690-claude-issue-4687-only-show-un-preview.mtcl.cc
📦 Docker Image ghcr.io/metaculus/metaculus:claude-issue-4687-only-show-unlisted-project-chip-35a7b0f
🗄️ PostgreSQL NeonDB branch preview/pr-4690-claude-issue-4687-only-show-un
Redis Fly Redis mtc-redis-pr-4690-claude-issue-4687-only-show-un

Details

  • Commit: 35a7b0f05b4ac9816a72ceb0a812fc1cb7bd31e4
  • Branch: claude/issue-4687-only-show-unlisted-project-chip
  • Fly App: metaculus-pr-4690-claude-issue-4687-only-show-un

ℹ️ Preview Environment Info

Isolation:

  • PostgreSQL and Redis are fully isolated from production
  • Each PR gets its own database branch and Redis instance
  • Changes pushed to this PR will trigger a new deployment

Limitations:

  • Background workers and cron jobs are not deployed in preview environments
  • If you need to test background jobs, use Heroku staging environments

Cleanup:

  • This preview will be automatically destroyed when the PR is closed

@SylvainChevalier
Copy link
Copy Markdown
Contributor Author

@claude the unlisted project chips are still visible even when they're not the default project.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 15, 2026

Claude finished @SylvainChevalier's task in 7m 6s —— View job


Investigation

  • Read the modified file (sidebar_question_projects.tsx)
  • Trace the filter logic through to backend serializers
  • Reviewed ProjectVisibility enum (frontend "unlisted") and backend Visibility.UNLISTED = "unlisted" — values match
  • Confirmed TournamentShortSerializer and CommunitySerializer include visibility in their output

Analysis

The filter at sidebar_question_projects.tsx:44-49 reads:

.filter(
  (project) =>
    !("visibility" in project) ||
    project.visibility !== ProjectVisibility.Unlisted ||
    project.id === defaultProjectId
);

Equivalent to: filter OUT a project when has visibility AND is unlisted AND id !== default_project.id. By inspection this should correctly hide a non-default unlisted tournament/community chip. Categories and leaderboard tags have no visibility and are unaffected.

Before I push a code change, I want to make sure I understand what you're seeing — could you confirm one of these for me:

  1. Is it that the filter isn't running at all? e.g. you're on a preview where the latest commit hasn't deployed. The current preview image (...-35a7b0f) was built 10 days ago — please confirm you're testing https://metaculus-pr-4690-claude-issue-4687-only-show-un-preview.mtcl.cc or local with this branch.
  2. Or do you actually want unlisted chips hidden in all cases, including when the unlisted project is the default project? The current PR intentionally keeps the chip in that case (per the PR description), but if you want them always hidden, that's a one-line change (drop the project.id === defaultProjectId exception).
  3. Or is the chip you're seeing not a tournament/community/index — e.g. is it a category or leaderboard_tag tied to an unlisted project? Those types don't carry a visibility field, so the current filter can't hide them.

If you can paste the URL of a question where you observe the bug (and ideally which chip is still showing), I can dig into the specific data and push a targeted fix.
• Branch: claude/issue-4687-only-show-unlisted-project-chip

@SylvainChevalier
Copy link
Copy Markdown
Contributor Author

Well, looks good now.

@SylvainChevalier SylvainChevalier marked this pull request as ready for review May 19, 2026 14:52
@SylvainChevalier SylvainChevalier requested a review from hlbmtc May 19, 2026 14:52
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.

Only show unlisted project chip if it's the main project of the question

1 participant