Skip to content

fix: hide "send back to review" button for non-approved posts - #5111

Draft
aseckin wants to merge 1 commit into
mainfrom
claude/issue-3029-send-back-to-review-button
Draft

fix: hide "send back to review" button for non-approved posts#5111
aseckin wants to merge 1 commit into
mainfrom
claude/issue-3029-send-back-to-review-button

Conversation

@aseckin

@aseckin aseckin commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an isApproved guard to the sendBackToReview visibility condition in post_dropdown_menu.tsx so the button only renders for posts that are actually eligible for the action.

Previously the button showed whenever the post had a future open_time and the viewer was admin/curator, but the backend send_back_to_review action requires curation_status == APPROVED. A PENDING/DRAFT/REJECTED post whose question had a future open_time would render the button, and clicking it would 400 on the server.

Fixes #3029

Test plan

  • Load a PENDING post whose underlying question has a future open_time as an admin — verify "Send back to review" is no longer in the menu
  • Load an APPROVED upcoming post as an admin/curator — verify "Send back to review" still appears and works
  • Load an APPROVED post whose open_time has already passed — verify button remains hidden

Generated with Claude Code

The frontend visibility condition only checked `isUpcoming`, so the
button showed on DRAFT/PENDING/REJECTED posts whose underlying question
had a future open_time — but the backend `send_back_to_review` action
requires `curation_status == APPROVED` and 400s otherwise.

Add an `isApproved` guard so the button visibility matches the backend
precondition.

Fixes #3029

Co-authored-by: aseckin <3686968+aseckin@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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 Plus

Run ID: b906fdd7-0b1e-4412-8b88-74cbda63c7a0

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

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.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Environment

Your preview environment is ready!

Resource Details
🌐 Preview URL https://metaculus-pr-5111-claude-issue-3029-send-back-to-preview.mtcl.cc
📦 Docker Image ghcr.io/metaculus/metaculus:claude-issue-3029-send-back-to-review-button-2c00848
🗄️ PostgreSQL NeonDB branch preview/pr-5111-claude-issue-3029-send-back-to
Redis Fly Redis mtc-redis-pr-5111-claude-issue-3029-send-back-to

Details

  • Commit: 2c00848869496669c07cf7876a9ec6c1db37b45a
  • Branch: claude/issue-3029-send-back-to-review-button
  • Fly App: metaculus-pr-5111-claude-issue-3029-send-back-to

ℹ️ 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

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.

send back to review button available when it shouldn't be

1 participant