Skip to content

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

Merged
merged 1 commit into from
Apr 22, 2025
Merged

Conversation

hentrymartin
Copy link
Collaborator

@hentrymartin hentrymartin commented Apr 17, 2025

What's in this PR?

  • Added handle to the invite list instead of email for copilot invitation(as it happens via handle)
  • Show the error message properly

Ticket link - https://topcoder.atlassian.net/browse/PM-1077

@@ -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, {

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 of inviteUserToProject, but it's not clear what properties it contains. Ensure that rest.message is a valid property and handle cases where it might not exist.

setAddUserError(error)
setIsAdding(false)
} else if (rest.message) {

Choose a reason for hiding this comment

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

The condition else if (rest.message) assumes that rest.message is an error message. Consider checking if rest.message is indeed an error or if it should be handled differently.

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

Choose a reason for hiding this comment

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

The variable name email is now being used to store a handle. Consider renaming the variable to handle for clarity and to avoid confusion, as it no longer represents an email address.

@hentrymartin hentrymartin requested a review from kkartunov April 17, 2025 15:51
@hentrymartin hentrymartin merged commit 70f514e into develop Apr 22, 2025
3 checks passed
@hentrymartin hentrymartin deleted the pm-972_1 branch April 22, 2025 14:02
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