Skip to content

Allow Curators to tag predictors#4088

Merged
hlbmtc merged 1 commit into
mainfrom
fix/curators-tag-predictors
Jan 16, 2026
Merged

Allow Curators to tag predictors#4088
hlbmtc merged 1 commit into
mainfrom
fix/curators-tag-predictors

Conversation

@hlbmtc
Copy link
Copy Markdown
Contributor

@hlbmtc hlbmtc commented Jan 16, 2026

Summary by CodeRabbit

  • New Features
    • Enhanced comment editor with permission-aware mention suggestions
    • Curator and admin users now have access to additional mention options when composing comments

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

The PR refactors permission handling throughout the comment and markdown editor components by replacing a boolean isStuff flag with a typed ProjectPermissions object. This prop is threaded from comment components through to the markdown editor initialization and mentions plugin system, where it conditionally determines which mention types are available.

Changes

Cohort / File(s) Summary
Comment Component Prop Threading
front_end/src/components/comment_feed/comment.tsx, front_end/src/components/comment_feed/comment_editor.tsx, front_end/src/components/comment_feed/index.tsx
Added userPermission prop sourced from postData?.user_permission and passed down to CommentEditor, which forwards it to MarkdownEditor. Updated CommentEditorProps interface to accept userPermission?: ProjectPermissions.
Markdown Editor Initialization
front_end/src/components/markdown_editor/initialized_editor.tsx
Added userPermission: ProjectPermissions prop to MarkdownEditorProps. Forwards userPermission to baseFormattingPlugins and mentionsPlugin, replacing hard-coded role-based logic.
Mentions Plugin Configuration
front_end/src/components/markdown_editor/plugins/mentions/components/plugin.tsx, front_end/src/components/markdown_editor/plugins/mentions/index.tsx
Replaced isStuff?: boolean prop with userPermission?: ProjectPermissions. Updated MentionsPlugin component signature and plugin configuration to accept and forward the typed permission object. Added ProjectPermissions import from "@/types/post".
Mentions Query Logic
front_end/src/components/markdown_editor/plugins/mentions/utils.ts
Updated queryMentions function signature to accept userPermission: ProjectPermissions instead of isStuff: boolean. Conditional logic now includes "predictors" in usersGroupMentions only when userPermission is CURATOR or ADMIN.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A permission refactor, clean and bright,
From flags and bools to types done right,
Through comment feeds the perms now flow,
To mentions plugins, all aglow,
Predictors appear when rights align—
A structured system, quite divine! 🌟

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Allow Curators to tag predictors' accurately reflects the main objective of the PR, which is to enable curators to mention/tag predictors by replacing isStuff checks with userPermission-based logic.

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

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb75322 and cd8bac1.

📒 Files selected for processing (7)
  • front_end/src/components/comment_feed/comment.tsx
  • front_end/src/components/comment_feed/comment_editor.tsx
  • front_end/src/components/comment_feed/index.tsx
  • front_end/src/components/markdown_editor/initialized_editor.tsx
  • front_end/src/components/markdown_editor/plugins/mentions/components/plugin.tsx
  • front_end/src/components/markdown_editor/plugins/mentions/index.tsx
  • front_end/src/components/markdown_editor/plugins/mentions/utils.ts
🧰 Additional context used
🧬 Code graph analysis (1)
front_end/src/components/markdown_editor/plugins/mentions/components/plugin.tsx (1)
front_end/src/components/markdown_editor/plugins/mentions/utils.ts (1)
  • queryMentions (6-48)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: integration-tests
  • GitHub Check: Frontend Checks
  • GitHub Check: Backend Checks
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (9)
front_end/src/components/comment_feed/index.tsx (1)

420-431: Prop passthrough looks good.
The new userPermission prop is cleanly forwarded and remains optional-safe.

front_end/src/components/comment_feed/comment.tsx (1)

1035-1046: Reply editor permission wiring looks correct.
This aligns the reply flow with the main editor permissions.

front_end/src/components/comment_feed/comment_editor.tsx (2)

20-48: Type addition is clean and optional-safe.
The new userPermission?: ProjectPermissions surface is clear and non-breaking.


221-230: MarkdownEditor receives permission context as intended.
This keeps mention behavior consistent with the new permissions model.

front_end/src/components/markdown_editor/plugins/mentions/utils.ts (1)

2-24: Permission gating for “predictors” is clear and scoped.
CURATOR/ADMIN-only inclusion aligns with the intended access model.

front_end/src/components/markdown_editor/plugins/mentions/components/plugin.tsx (1)

7-36: MentionsPlugin wiring is consistent with new API.
Prop threading and query call updates look correct.

front_end/src/components/markdown_editor/initialized_editor.tsx (2)

42-42: Props and type definition properly updated.

The userPermission prop is correctly added to the type definition and destructured in the component. The optional typing is appropriate since it's only relevant when withUserMentions is enabled.

Also applies to: 130-130, 153-153


239-246: Dependency array correctly updated for permission-reactive memoization.

The userPermission is properly passed to mentionsPlugin and correctly included in the useMemo dependency array. This ensures the plugins are recalculated when permissions change. Callers of InitializedMarkdownEditor that enable withUserMentions (notably comment_editor.tsx) are properly updated to pass userPermission.

front_end/src/components/markdown_editor/plugins/mentions/index.tsx (1)

12-13: LGTM! Clean refactor from boolean flag to typed permissions.

The change from isStuff?: boolean to userPermission?: ProjectPermissions is properly implemented throughout. The userPermission prop is correctly threaded through the plugin config, passed to the MentionsPlugin component, and properly utilized in the queryMentions utility to conditionally add group mentions based on user permissions (specifically "predictors" for CURATOR and ADMIN roles).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

@hlbmtc hlbmtc requested a review from cemreinanc January 16, 2026 20:42
@hlbmtc hlbmtc merged commit 9303c49 into main Jan 16, 2026
8 checks passed
@hlbmtc hlbmtc deleted the fix/curators-tag-predictors branch January 16, 2026 22:38
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