Skip to content

Conversation

@YashodhanJoshi1
Copy link
Contributor

@YashodhanJoshi1 YashodhanJoshi1 commented Dec 1, 2025

Fixes for various p2 bugs and UI issues, some other functionality changes as well.
NOTE: because of some CLA issues, I have squashed all the original commits into a single one. There are no code changes compared to before.

@CLAassistant
Copy link

CLAassistant commented Dec 1, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Dec 1, 2025
@YashodhanJoshi1 YashodhanJoshi1 marked this pull request as ready for review December 8, 2025 04:44
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 8, 2025

Greptile Overview

Greptile Summary

This PR implements comprehensive fixes for cloud organization management, focusing on billing restrictions, invitation workflows, and UI improvements.

Key Changes:

  • Free Organization Restrictions: Enforced rule that users cannot be part of multiple free organizations - validated during org creation, invitation generation, invitation acceptance, and invitation decline
  • Email Domain Validation: Added email domain checking when inviting users to organizations
  • Invitation Management:
    • Added token field to invitation records for proper tracking
    • Modified decline_invitation to return remaining invitations and auto-create org when user has no remaining invitations
    • Added revoke invitation functionality for admins to cancel pending invites
  • Token Generation Refactor: Moved invitation token generation from service layer to enterprise org_invites::add_many function, removing redundant parameter passing
  • Frontend Enhancements:
    • Added dedicated Invitations view and tab (cloud-only)
    • Implemented pagination for invitation lists
    • Added revoke invite button with confirmation dialog
    • Email deduplication in member invitation form
    • Improved error handling with better error messages from backend
    • Role capitalization for display (Admin instead of admin)
    • Auto-refresh after invite actions
  • Localization: Added translations for "revoke_invite" and "invitations" across all supported languages
  • UI Polish: Fixed grammar ("has expired" instead of "has been expired"), improved spacing and formatting

Confidence Score: 4/5

  • This PR is generally safe to merge with minor attention needed on billing validation logic
  • The changes are well-structured and address multiple P2 bugs. The free org restriction logic is implemented consistently across multiple entry points. However, the score is 4 rather than 5 due to the complexity of the billing validation logic that checks multiple async conditions and could benefit from additional integration testing to ensure edge cases are handled properly (e.g., race conditions when multiple operations happen simultaneously)
  • Pay close attention to src/service/organization.rs - the billing validation logic with multiple nested checks should be tested thoroughly for edge cases and race conditions

Important Files Changed

File Analysis

Filename Score Overview
src/service/organization.rs 4/5 Added billing checks for free org restrictions, email domain validation, token generation moved to enterprise code, and return type change for decline_invitation
src/handler/http/request/users/mod.rs 4/5 Added logic to create a new org when user declines all invitations and has no remaining invitations
web/src/components/iam/users/User.vue 5/5 Added revoke invite button, better error handling, role capitalization, and refresh on invite sent
web/src/components/iam/users/InvitationList.vue 5/5 Added pagination, improved error handling, and added row numbering to invitations table
web/src/components/iam/users/MemberInvitation.vue 5/5 Added deduplication for email invites and improved error handling with emit event for refresh
web/src/views/Invitations.vue 5/5 New view component for managing invitations

Sequence Diagram

sequenceDiagram
    participant Admin
    participant Frontend
    participant Backend
    participant DB
    participant Email
    
    Note over Admin,Email: Invite User Flow
    Admin->>Frontend: Send invitation
    Frontend->>Backend: POST /api/{org_id}/invites
    Backend->>Backend: Check billing status (free org restrictions)
    Backend->>Backend: Validate email domain
    Backend->>Backend: Check invitee not in another free org
    Backend->>DB: Store invitation with generated token
    Backend->>Email: Send invitation email
    Backend-->>Frontend: Success response
    
    Note over Admin,Email: Accept Invitation Flow
    participant User
    User->>Backend: PUT /api/{org_id}/member_subscription/{token}
    Backend->>DB: Get invitation by token
    Backend->>Backend: Check billing (user can't join multiple free orgs)
    Backend->>DB: Add user to organization
    Backend->>DB: Update invitation status to Accepted
    Backend-->>User: Success
    
    Note over Admin,Email: Decline Invitation Flow
    User->>Backend: DELETE /api/invites/{token}
    Backend->>DB: Update invitation status to Rejected
    Backend->>DB: Get remaining pending invitations
    alt No remaining invitations
        Backend->>Backend: Create new org for user
    end
    Backend-->>User: Success with remaining count
    
    Note over Admin,Email: Revoke Invitation Flow
    Admin->>Frontend: Click revoke invite
    Frontend->>Backend: DELETE /api/{org_id}/invites/{token}
    Backend->>DB: Delete invitation by token
    Backend-->>Frontend: Success
    Frontend->>Frontend: Refresh member list
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

22 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

YashodhanJoshi1 added a commit that referenced this pull request Dec 10, 2025
This squashes the commits from the main PR
(#9416) for the release
branch.

Signed-off-by: Yashodhan Joshi <[email protected]>
Co-authored-by: Yashodhan Joshi <[email protected]>
commit 7d34c2b26b92ccdbc14a1859ed573af3eb376566
Merge: dd70a36 5d591fc
Author: Yashodhan Joshi <[email protected]>
Date:   Wed Dec 10 14:20:15 2025 +0530

    Merge branch 'main' into fix/cloud_orgs

commit dd70a36
Author: omkark06 <[email protected]>
Date:   Tue Dec 9 11:50:42 2025 +0530

    fix: signout if verifyuser api fails

commit 93caae0
Author: omkark06 <[email protected]>
Date:   Tue Dec 9 11:26:43 2025 +0530

    fix: logout user when organizations api fails with 403

commit 86e67c3
Author: omkark06 <[email protected]>
Date:   Mon Dec 8 18:12:22 2025 +0530

    fix: fetch pending invites on login to check if invites exists

commit c81a1e7
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 8 13:24:31 2025 +0530

    fix: ui unit test cases

commit 0903865
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 8 12:02:50 2025 +0530

    fix: invitationList as per updated UI theme

commit 6e45401
Merge: 4bdc0b4 5045e3a
Author: Yashodhan Joshi <[email protected]>
Date:   Mon Dec 8 10:04:25 2025 +0530

    Merge branch 'main' into fix/cloud_orgs

commit 4bdc0b4
Merge: 40a21e1 6e857ea
Author: Yashodhan Joshi <[email protected]>
Date:   Tue Dec 2 11:13:53 2025 +0530

    Merge branch 'main' into fix/cloud_orgs

commit 40a21e1
Author: Yashodhan Joshi <[email protected]>
Date:   Tue Dec 2 10:55:55 2025 +0530

    fix: geenrate token in invite addition

    Signed-off-by: Yashodhan Joshi <[email protected]>

commit 73a9236
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 1 18:14:34 2025 +0530

    fix: refresh the list after succesfull invite

commit 37d0e78
Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Date:   Mon Dec 1 12:41:28 2025 +0000

    chore: update translations from en.json

    Auto-generated translation updates from English source file.

    🤖 Generated with automated translation workflow

commit 07d27a0
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 1 18:11:02 2025 +0530

    fix: revoke method added for invites

commit 3200478
Author: Yashodhan Joshi <[email protected]>
Date:   Mon Dec 1 17:33:05 2025 +0530

    fix: sent token in the invites api

    Signed-off-by: Yashodhan Joshi <[email protected]>

commit d7ac784
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 1 16:46:35 2025 +0530

    fix: trail period message change

commit 4cce5cd
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 1 16:27:14 2025 +0530

    fix: should show the role in capital letter

commit 99ec65e
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 1 16:22:25 2025 +0530

    fix: show error if same email id sent for invite

commit 237bac4
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 1 16:18:39 2025 +0530

    fix: shows search input , dedup emails ids

commit 85ac4bd
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 1 15:13:25 2025 +0530

    fix: merge conflicts in user.vue

commit bc31ad7
Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Date:   Mon Dec 1 09:42:15 2025 +0000

    chore: update translations from en.json

    Auto-generated translation updates from English source file.

    🤖 Generated with automated translation workflow

commit 2b8a82a
Merge: 0d7b2a2 4ecc550
Author: sai nikhil kethe <[email protected]>
Date:   Mon Dec 1 15:11:45 2025 +0530

    Merge branch 'main' into fix/cloud_orgs

commit 0d7b2a2
Author: Yashodhan Joshi <[email protected]>
Date:   Fri Oct 3 10:19:57 2025 +0530

    fix: check domain on invite also

    Signed-off-by: Yashodhan Joshi <[email protected]>

commit f8c47eb
Merge: 193fd67 9d357d0
Author: Yashodhan Joshi <[email protected]>
Date:   Fri Oct 3 10:24:30 2025 +0530

    Merge branch 'main' into fix/cloud_orgs

    Signed-off-by: Yashodhan Joshi <[email protected]>

commit 193fd67
Author: omkark06 <[email protected]>
Date:   Mon Sep 22 11:14:51 2025 +0530

    fix: removed empty tag

commit b8299f7
Merge: d42f30a 83663f6
Author: Yashodhan Joshi <[email protected]>
Date:   Mon Sep 22 10:45:48 2025 +0530

    Merge branch 'main' into fix/cloud_orgs

commit d42f30a
Merge: b65e868 d40b6af
Author: Yashodhan Joshi <[email protected]>
Date:   Thu Sep 18 14:31:40 2025 +0530

    Merge branch 'main' into fix/cloud_orgs

commit b65e868
Author: omkark06 <[email protected]>
Date:   Fri Sep 5 16:25:14 2025 +0530

    fix: Invitations in IAM

commit f560b06
Author: Yashodhan Joshi <[email protected]>
Date:   Thu Sep 4 11:50:01 2025 +0530

    fix: allow user to only be part of one free org via invitation

    Signed-off-by: Yashodhan Joshi <[email protected]>

commit 7233af3
Author: Yashodhan Joshi <[email protected]>
Date:   Wed Sep 3 16:50:00 2025 +0530

    feat: create new org for new user after all invitation decline

    Signed-off-by: Yashodhan Joshi <[email protected]>

Signed-off-by: Yashodhan Joshi <[email protected]>
@YashodhanJoshi1 YashodhanJoshi1 merged commit 6493f2b into main Dec 10, 2025
45 of 58 checks passed
@YashodhanJoshi1 YashodhanJoshi1 deleted the fix/cloud_orgs branch December 10, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants