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 : An option for users to leave the Organization #2262

Closed
wants to merge 3 commits into from
Closed

Feat : An option for users to leave the Organization #2262

wants to merge 3 commits into from

Conversation

AnshulKahar2729
Copy link

@AnshulKahar2729 AnshulKahar2729 commented Sep 10, 2024

What kind of change does this PR introduce?
feature

Issue Number:
Fixes #1873

Did you add tests for your changes?
No

Have you read the contributing guide?
Yes

Summary by CodeRabbit

  • New Features

    • Added confirmation prompts for leaving an organization in multiple languages (English, French, Hindi, Spanish).
    • Introduced a new button in the organization card for users to leave their organization, accompanied by a confirmation modal.
    • Implemented a new GraphQL mutation to facilitate the action of leaving an organization.
    • Enhanced user interface with new styles for buttons and modals related to leaving an organization.
  • Bug Fixes

    • Improved clarity and user guidance regarding leaving an organization, addressing potential confusion.
  • Documentation

    • Updated localization files to include new strings and translations for improved user experience.

Copy link

coderabbitai bot commented Sep 10, 2024

Warning

Rate limit exceeded

@AnshulKahar2729 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 22 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 5172622 and e690d2f.

Walkthrough

The pull request introduces a feature allowing users to leave an organization. This includes the addition of a new GraphQL mutation, localization updates for various languages, and user interface enhancements such as a confirmation modal and new styling for buttons. The changes are implemented across multiple files, improving both functionality and user experience without affecting existing features.

Changes

Files Change Summary
public/locales/en/common.json Added "confirm": "Confirm" for confirmation action.
public/locales/en/translation.json Added keys for "leave" actions and new section "orgLeave" with confirmation prompts and messages.
public/locales/fr/common.json Added "confirm": "Confirmer" for confirmation action in French.
public/locales/fr/translation.json Added keys for "leave" actions and new section "orgLeave" with French translations.
public/locales/hi/common.json Added "confirm": "पुष्टि करें" for confirmation action in Hindi.
public/locales/hi/translation.json Added keys for "leave" actions and new section "orgLeave" with Hindi translations.
public/locales/sp/common.json Added "confirm": "Confirmar" for confirmation action in Spanish.
public/locales/sp/translation.json Added keys for "leave" actions and new section "orgLeave" with Spanish translations.
src/GraphQl/Mutations/OrganizationMutations.ts Added LEAVE_ORGANIZATION mutation for leaving an organization.
src/GraphQl/Mutations/mutations.ts Exported LEAVE_ORGANIZATION mutation.
src/components/UserPortal/OrganizationCard/OrganizationCard.module.css Added styles for new .leaveBtn and modified .btnContainer.
src/components/UserPortal/OrganizationCard/OrganizationCard.tsx Added new "Leave" button and modal for confirmation.
src/components/UserPortal/UserSidebarOrg/LeaveConfirmModal.module.css Added styles for leave confirmation modal footer.
src/components/UserPortal/UserSidebarOrg/LeaveConfirmModal.tsx Introduced LeaveConfirmModal component for confirmation before leaving an organization.
src/components/UserPortal/UserSidebarOrg/UserSidebarOrg.module.css Added styles for .leaveOrgContainer to enhance layout.
src/components/UserPortal/UserSidebarOrg/UserSidebarOrg.tsx Added leave functionality and modal integration for user organization management.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant OrganizationCard
    participant LeaveConfirmModal
    participant GraphQL

    User->>OrganizationCard: Click "Leave" button
    OrganizationCard->>LeaveConfirmModal: Show confirmation modal
    User->>LeaveConfirmModal: Confirm leaving
    LeaveConfirmModal->>GraphQL: Call LEAVE_ORGANIZATION mutation
    GraphQL-->>LeaveConfirmModal: Return success
    LeaveConfirmModal->>User: Show success notification
Loading

Assessment against linked issues

Objective Addressed Explanation
Option for users to leave the Organization (#1873)
Clear confirmation for leaving an organization (#1873)
User interface for leaving organization (#1873)

🐰 In the meadow, where bunnies play,
A feature blooms, bright as day.
"Leave" they say, with a hop and a cheer,
Confirm your choice, no need to fear!
With styles anew and buttons that gleam,
User's wishes fulfilled, like a sweet dream! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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.

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

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

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: 0

Outside diff range, codebase verification and nitpick comments (2)
src/components/UserPortal/UserSidebarOrg/LeaveConfirmModal.tsx (1)

33-50: LGTM, but consider improving error handling and extracting redirection logic.

The leaveOrg function is well-structured and handles the mutation and its outcomes appropriately. However, consider the following suggestions for improvement:

  1. Provide more specific error messages based on the error type to give users more context about what went wrong.
  2. Extract the redirection logic into a separate function for better separation of concerns and reusability.
src/components/UserPortal/OrganizationCard/OrganizationCard.module.css (1)

61-66: LGTM, but consider removing the right margin.

The .leaveBtn class is appropriately named and follows the CSS module naming convention. The styles are consistent with the existing button styles in the file. However, the right margin of 9rem seems excessive and may not be necessary. Consider removing it to maintain consistent spacing with other buttons.

.leaveBtn {
  display: flex;
  justify-content: space-around;
  width: 8rem;
- margin-right: 9rem;
}
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 315641f and 5172622.

Files selected for processing (16)
  • public/locales/en/common.json (1 hunks)
  • public/locales/en/translation.json (3 hunks)
  • public/locales/fr/common.json (1 hunks)
  • public/locales/fr/translation.json (3 hunks)
  • public/locales/hi/common.json (1 hunks)
  • public/locales/hi/translation.json (3 hunks)
  • public/locales/sp/common.json (1 hunks)
  • public/locales/sp/translation.json (3 hunks)
  • src/GraphQl/Mutations/OrganizationMutations.ts (1 hunks)
  • src/GraphQl/Mutations/mutations.ts (1 hunks)
  • src/components/UserPortal/OrganizationCard/OrganizationCard.module.css (2 hunks)
  • src/components/UserPortal/OrganizationCard/OrganizationCard.tsx (3 hunks)
  • src/components/UserPortal/UserSidebarOrg/LeaveConfirmModal.module.css (1 hunks)
  • src/components/UserPortal/UserSidebarOrg/LeaveConfirmModal.tsx (1 hunks)
  • src/components/UserPortal/UserSidebarOrg/UserSidebarOrg.module.css (1 hunks)
  • src/components/UserPortal/UserSidebarOrg/UserSidebarOrg.tsx (3 hunks)
Files skipped from review due to trivial changes (5)
  • public/locales/en/common.json
  • public/locales/fr/common.json
  • public/locales/hi/common.json
  • public/locales/sp/common.json
  • src/components/UserPortal/UserSidebarOrg/LeaveConfirmModal.module.css
Additional comments not posted (27)
src/components/UserPortal/UserSidebarOrg/LeaveConfirmModal.tsx (2)

1-16: LGTM!

The import statements and component props interface are well-organized and follow best practices. The InterfaceLeaveConfirmModalProps interface clearly defines the expected properties for the component.


51-73: LGTM!

The modal rendering is straightforward and uses Bootstrap components effectively. The translations are properly used for the modal title, confirmation message, and button labels. The modal is centered and sized appropriately.

src/components/UserPortal/OrganizationCard/OrganizationCard.module.css (1)

150-154: LGTM!

The modifications to the .btnContainer class within the .orgCard class improve the layout and spacing of buttons. Using flexbox with a column direction stacks the buttons vertically, which is appropriate for the card layout. The gap of 0.5rem provides consistent spacing between the buttons.

src/components/UserPortal/UserSidebarOrg/UserSidebarOrg.module.css (1)

112-135: LGTM!

The .leaveOrgContainer class and its associated styles are appropriately named and follow the CSS module naming convention. The styles are consistent with the existing sidebar styles and provide a clear visual indication of the leave organization action. The focus state ensures a clean appearance when the container is focused. The primary text color and leave icon styles emphasize the importance of the action.

src/GraphQl/Mutations/OrganizationMutations.ts (1)

286-292: LGTM!

The code changes are approved.

src/components/UserPortal/UserSidebarOrg/UserSidebarOrg.tsx (3)

50-50: LGTM!

The code changes are approved.


133-170: LGTM!

The code changes are approved.


16-17: LGTM!

The code changes are approved.

src/components/UserPortal/OrganizationCard/OrganizationCard.tsx (3)

81-81: LGTM!

The code changes are approved.


193-219: LGTM!

The code changes are approved.


20-20: LGTM!

The code changes are approved.

src/GraphQl/Mutations/mutations.ts (1)

725-725: LGTM, but verify the mutation usage.

The addition of the LEAVE_ORGANIZATION mutation is approved.

However, ensure that this mutation is properly integrated and all necessary changes have been made across the codebase to handle the user leaving an organization. This may include updating the UI, revoking permissions, handling edge cases, etc.

Run the following script to verify the mutation usage:

public/locales/en/translation.json (5)

151-151: LGTM!

The addition of the "leave" translation string is approved.


770-770: LGTM!

The addition of the "leave" translation string under the "userSidebarOrg" section is approved.


1057-1062: LGTM!

The addition of the "orgLeave" section with its translation strings is approved. The translations provide clear and informative messages for the user throughout the process of leaving an organization.


1058-1058: LGTM!

The "confirmation" translation string is approved. Asking for user confirmation before leaving an organization is a necessary step to prevent accidental actions.


1060-1060: Excellent description of the consequences of leaving an organization!

The "description" translation string provides a clear and comprehensive explanation of the implications of leaving an organization. It effectively communicates the irreversibility of the action, potential loss of data and permissions, and the need for approval to rejoin if required.

This level of transparency is crucial for users to make informed decisions and understand the gravity of their actions. Well done!

public/locales/hi/translation.json (4)

153-154: LGTM!

The code changes are approved.


769-769: LGTM!

The code changes are approved.


770-770: LGTM!

The code changes are approved.


1058-1063: LGTM!

The code changes are approved.

public/locales/fr/translation.json (3)

151-151: LGTM!

The addition of the "leave" key with the French translation "partir" looks good.


770-770: LGTM!

The addition of the "leave" key with the French translation "Quitter l'organisation" in the "userSidebarOrg" section looks good.


1058-1063: Looks great!

The new "orgLeave" section with the relevant French translations for the process of leaving an organization is a valuable addition. The translations are clear, consistent, and enhance the user experience by providing necessary prompts and confirmations.

public/locales/sp/translation.json (3)

231-231: LGTM!

The addition of the "leave" key with the Spanish translation "Dejar" in the "users" section looks good.


966-966: LGTM!

The addition of the "leave" key with the Spanish translation "Dejar la organización" in the "userSidebarOrg" section looks good.


1292-1297: Looks great!

The new "orgLeave" section with the relevant Spanish translations for the process of leaving an organization is a valuable addition. The translations are clear, consistent, and enhance the user experience by providing necessary prompts and confirmations.

@AnshulKahar2729
Copy link
Author

fixing

@AnshulKahar2729 AnshulKahar2729 closed this by deleting the head repository Sep 14, 2024
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