-
Notifications
You must be signed in to change notification settings - Fork 51
fix(PM-1077): handled errors for certain use cases #1643
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,14 +46,17 @@ const UserAddModalContent = ({ projectId, addNewProjectMember, onMemberInvited, | |
|
||
try { | ||
if (userPermissionToAdd === PROJECT_ROLES.COPILOT) { | ||
const { success: invitations = [], failed } = await inviteUserToProject(projectId, { | ||
const { success: invitations = [], failed, ...rest } = await inviteUserToProject(projectId, { | ||
handles: [userToAdd.handle], | ||
role: userPermissionToAdd | ||
}) | ||
if (failed) { | ||
const error = get(failed, '0.message', 'Unable to invite user') | ||
const error = get(failed, '0.message', 'User cannot be invited') | ||
setAddUserError(error) | ||
setIsAdding(false) | ||
} else if (rest.message) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The condition |
||
setAddUserError(rest.message) | ||
setIsAdding(false) | ||
} else { | ||
onMemberInvited(invitations[0] || {}) | ||
onClose() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ class Users extends Component { | |
projectMembers, | ||
invitedMembers: invitedMembers.map(m => ({ | ||
...m, | ||
email: m.email || invitedUsers[m.userId].email | ||
email: m.email || invitedUsers[m.userId].handle | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable name |
||
})) | ||
}) | ||
const { loggedInUser } = this.props | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable
rest
is being destructured from the response ofinviteUserToProject
, but it's not clear what properties it contains. Ensure thatrest.message
is a valid property and handle cases where it might not exist.