Fix user role update workspace#373
Open
Lazygarde wants to merge 2 commits into
Open
Conversation
a56c91c to
221ec5f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: User Role Update in Workspace
Problems
Two bugs were found in the workspace user role management flow:
1. Wrong user ID sent in role update API call
UserRoleUpdateMutationHandlerwas usinginput.userId(the current logged-in user) as the target in the API URL instead ofinput.targetUserId(the user whose role is being changed). This caused the role update request to target the wrong user.Additionally,
WorkspaceUserRoleDropdownwas passingaccountIdandworkspaceIddirectly from the component into the mutation input, while the handler already resolves these from workspace context — leading to confusion between the acting user and the target user.2. UI not reflecting role changes after update
UserService.upsertUser()andUserService.syncServerUser()always emitted auser.createdevent even when the user record already existed (i.e., an upsert/update scenario). Components listening foruser.updatedevents never received the signal, so the UI did not re-render after a role change.Changes
packages/client/src/mutations/users/user-role-update.tstargetUserIdfield toUserRoleUpdateMutationInputto explicitly distinguish the target user from the acting user (userId).packages/client/src/handlers/mutations/users/user-role-update.tsinput.targetUserIdinstead ofinput.userId.packages/ui/src/components/workspaces/workspace-user-role-dropdown.tsxuserId→targetUserIdfor clarity.userId: workspace.userId(acting user) andtargetUserId(target user) instead of incorrectly passingaccountId/workspaceId.packages/ui/src/components/workspaces/workspace-users-container.tsxtargetUserIdto match the dropdown component change.packages/client/src/services/workspaces/user-service.tsuser.updatedevent if the record existed, oruser.createdif it is new.upsertUser()andsyncServerUser().Testing