Skip to content

Replace mock maintainer flag with user role check - #286

Closed
YashMahawa wants to merge 1 commit into
boundlessfi:mainfrom
YashMahawa:fix/use-role-bounty-sidebar
Closed

Replace mock maintainer flag with user role check#286
YashMahawa wants to merge 1 commit into
boundlessfi:mainfrom
YashMahawa:fix/use-role-bounty-sidebar

Conversation

@YashMahawa

@YashMahawa YashMahawa commented Jun 26, 2026

Copy link
Copy Markdown

Summary

  • Replace the NEXT_PUBLIC_MOCK_MAINTAINER gate in BountySidebar with the existing useUserRole() hook
  • Show maintainer-only completion/rating UI only when the current user role is sponsor
  • Remove the dev-only console warning tied to the mock maintainer env flag

Closes #274

Validation

  • pnpm install --frozen-lockfile with pnpm 10.25.0
  • pnpm lint (passes with one existing warning in lib/server-graphql.ts)
  • pnpm build

Notes

  • The diff is intentionally limited to components/bounty/bounty-sidebar.tsx.
  • pnpm exec tsc --noEmit still hits the repo's pre-existing missing @jest/globals test dependency in components/reputation/__tests__/my-claims.test.ts, so this PR leaves that unrelated dependency cleanup out of scope.
  • Vercel is blocked by external fork deployment authorization.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

@YashMahawa is attempting to deploy a commit to the Threadflow Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The bounty sidebar now derives maintainer access from useUserRole() and uses that role for completion, rating, button rendering, and rating text. The PR also adds @jest/globals as a dev dependency.

Changes

Maintainer role gating

Layer / File(s) Summary
Role state derivation
components/bounty/bounty-sidebar.tsx
Imports useUserRole() and derives isMaintainer from the returned role.
Maintainer-gated actions and text
components/bounty/bounty-sidebar.tsx
handleMarkCompleted, handleSubmitRating, the action button, and the post-rating message now use isMaintainer.

Jest globals dependency

Layer / File(s) Summary
Add Jest globals
package.json
Adds @jest/globals to devDependencies at 30.2.0.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • boundlessfi/bounties#75: Updates the same bounty sidebar maintainer-gating flow from the mock flag to useUserRole().

Suggested reviewers

  • Benjtalkshow

Poem

A bunny tapped the sidebar’s door,
And role checks hopped in from the store.
The sponsor moonlit through the code,
While jesty globals shared the load. 🐰

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning package.json adds @jest/globals, which is unrelated to #274's bounty sidebar role-gating changes and appears out of scope. Move the dev-dependency update to a separate PR or justify it in the linked issue scope, keeping this PR limited to the sidebar role-check change.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: replacing the mock maintainer flag with a user role check.
Linked Issues check ✅ Passed The sidebar now uses useUserRole-based maintainer checks and removes the env-flag flow, matching issue #274's sponsor/contributor gating.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@YashMahawa

YashMahawa commented Jun 26, 2026

Copy link
Copy Markdown
Author

Superseding my earlier validation note after tightening the PR scope: I removed the out-of-scope package/lockfile dependency change, so the diff is now only components/bounty/bounty-sidebar.tsx.

Current local validation on the updated branch:

  • pnpm install --frozen-lockfile with pnpm 10.25.0
  • pnpm lint (passes with one existing warning in lib/server-graphql.ts)
  • pnpm build

pnpm exec tsc --noEmit still hits the repo’s existing missing @jest/globals test dependency in components/reputation/__tests__/my-claims.test.ts, so I left that unrelated dependency cleanup out of this PR. Vercel remains blocked by external-fork deployment authorization.

@YashMahawa
YashMahawa force-pushed the fix/use-role-bounty-sidebar branch from 33208b3 to 1b7c9bd Compare June 26, 2026 12:28
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.

Replace NEXT_PUBLIC_MOCK_MAINTAINER env flag with useUserRole hook

2 participants