Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/display all members invite toggle #3200

Closed
wants to merge 3 commits into from

Conversation

carlosmonastyrski
Copy link
Contributor

@carlosmonastyrski carlosmonastyrski commented Mar 7, 2025

Description 📣

Added a new 'Products' tab in Organization Settings to manage product-related options. Currently, it includes a single toggle for enabling/disabling the 'Add all members of my organization to this project' option in the project creation modal. A new field was added to the organizations table, defaulting to true to preserve existing behavior.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

https://www.loom.com/share/4ec308d0fbdc4d61a7080dff367a0ff3?sid=59a75731-ce29-49e5-a3ae-b1e02cbc8975

# Here's some code block to paste some code snippets

Summary by CodeRabbit

  • New Features
    • Added a configurable setting to control the display of member invitations in organization updates.
    • Introduced a new "Products" tab within the organization settings, offering product-specific configuration options.
    • Enhanced the project creation modal to conditionally show the member invitation checkbox based on the updated organization settings.
    • Added a new ProductSettings component for managing member invitation display settings.

Copy link

coderabbitai bot commented Mar 7, 2025

Walkthrough

This pull request introduces a new boolean flag, displayAllMembersInvite, to manage organization member invitation settings. A new migration file updates the database schema by adding this column to the Organization table, with corresponding functions to add and remove the column during migrations. The organizations schema, data transfer objects, and update service now include the new property, ensuring its propagation throughout the system. On the frontend, form schemas and API calls are updated to include the new flag. The New Project Modal conditionally renders the add members checkbox based on this setting, and a new "Products" tab is added to the organization settings page, which integrates a newly created ProductSettings component that manages the display of the member invite toggle through API calls and state updates.

Suggested reviewers

  • akhilmhdh
  • scott-ray-wilson

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

backend/src/db/migrations/20250307001101_add-display-all-members-invite-to-org.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/backend".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in "backend/.eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 117617b and 4a8dae5.

📒 Files selected for processing (2)
  • backend/src/db/migrations/20250307001101_add-display-all-members-invite-to-org.ts (1 hunks)
  • frontend/src/hooks/api/organization/types.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/src/hooks/api/organization/types.ts
  • backend/src/db/migrations/20250307001101_add-display-all-members-invite-to-org.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Run integration test
  • GitHub Check: Check TS and Lint
  • GitHub Check: Check API Changes
  • GitHub Check: Check Frontend Type and Lint check

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 58ebebb and 117617b.

📒 Files selected for processing (10)
  • backend/src/db/migrations/20250307001101_add-display-all-members-invite-to-org.ts (1 hunks)
  • backend/src/db/schemas/organizations.ts (1 hunks)
  • backend/src/server/routes/v1/organization-router.ts (1 hunks)
  • backend/src/services/org/org-service.ts (2 hunks)
  • backend/src/services/org/org-types.ts (1 hunks)
  • frontend/src/components/projects/NewProjectModal.tsx (2 hunks)
  • frontend/src/hooks/api/organization/queries.tsx (2 hunks)
  • frontend/src/hooks/api/organization/types.ts (1 hunks)
  • frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx (2 hunks)
  • frontend/src/pages/organization/SettingsPage/components/ProductSettings/ProductSettings.tsx (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Check Frontend Type and Lint check
frontend/src/components/projects/NewProjectModal.tsx

[error] 249-249: error TS2339: Property 'displayAllMembersInvite' does not exist on type 'Organization'.

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Check API Changes
  • GitHub Check: Check TS and Lint
  • GitHub Check: Run integration test
🔇 Additional comments (14)
frontend/src/hooks/api/organization/types.ts (1)

29-29: LGTM: New boolean flag added correctly

The addition of the optional displayAllMembersInvite boolean property to the UpdateOrgDTO type aligns perfectly with the PR objective of controlling member invitation visibility.

backend/src/services/org/org-types.ts (1)

75-75: LGTM: Backend type definition added properly

The addition of the displayAllMembersInvite boolean property to the TUpdateOrgDTO type correctly mirrors the frontend changes and completes the type definition for the new feature.

backend/src/db/schemas/organizations.ts (1)

25-26: LGTM: Schema updated with correct default value

The addition of the displayAllMembersInvite property with a default value of true ensures backward compatibility with existing behavior as specified in the PR objectives.

backend/src/server/routes/v1/organization-router.ts (1)

260-261: LGTM: API schema updated correctly

The addition of the optional displayAllMembersInvite boolean property to the request body schema properly enables the API endpoint to accept this new parameter when updating an organization.

frontend/src/hooks/api/organization/queries.tsx (1)

112-114: Good implementation of the new organization property

The displayAllMembersInvite parameter is correctly added to both the mutation function signature and the request payload, following the established pattern in the codebase.

Also applies to: 122-124

frontend/src/components/projects/NewProjectModal.tsx (1)

54-54: Good default value addition

Setting a default value of false for the addMembers field ensures predictable behavior when the form is initialized.

backend/src/db/migrations/20250307001101_add-display-all-members-invite-to-org.ts (1)

5-11: LGTM: Good migration implementation for adding the column

The up function correctly adds the displayAllMembersInvite boolean column with a default value of true to the Organization table.

frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx (1)

14-14: Good addition of the Products tab

The new Products tab is properly integrated into the organization settings page, following the established pattern of other tabs.

#!/bin/bash
# Check if ProductSettings component exists
fd -t f "ProductSettings.tsx" --exec ls -la {}

Also applies to: 24-24

backend/src/services/org/org-service.ts (2)

283-299: Feature addition looks correct

The displayAllMembersInvite property has been correctly added to the updateOrg function parameters. This new property follows the same pattern as other organization settings and will be used to control whether all members are displayed in the invite section during project creation.


363-372: Correct implementation of updating the organization property

The displayAllMembersInvite property is properly included in the object passed to orgDAL.updateById(). Unlike some other properties (e.g., enforceMfa or authEnforced), there are no permission or plan restrictions for this property, which seems appropriate for this feature.

frontend/src/pages/organization/SettingsPage/components/ProductSettings/ProductSettings.tsx (4)

7-61: Well-implemented ProductConfigSection component with proper error handling

The ProductConfigSection component implements the toggle for displaying all members during project creation. It has good error handling (lines 11-31), provides user feedback through notifications, and correctly checks for the existence of the current organization before making API calls.


11-31: Robust toggle handler implementation

The handleDisplayAllMembersInviteToggle function checks if organization data is available before making the API call, provides user feedback on success or failure, and handles errors appropriately.


44-53: Good permission implementation

The toggle is correctly wrapped in an OrgPermissionCan component to restrict who can edit this setting based on their organization permissions. The toggle is disabled if the user doesn't have the required permissions.


63-69: Simple wrapper component

The ProductSettings component serves as a simple wrapper for the configuration section. This structure allows for easy addition of more product-related settings in the future.

Copy link
Member

@sheensantoscapadngan sheensantoscapadngan left a comment

Choose a reason for hiding this comment

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

z

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.

2 participants