-
Notifications
You must be signed in to change notification settings - Fork 18
Add error message when Space user exists on Org user removal. #1163
Changes from 25 commits
88c99a3
c48c3eb
4487850
28b56da
b123cd9
f4b550f
e8c967e
1e30a66
d0a8766
faf2819
f782d65
24b0ba7
01eef76
ba99e8d
67d0596
0ed162f
3c883d5
792214e
9e8ea37
fd13220
46bbd74
684ab14
45bc78b
b7815d0
3c72fe2
d9984cc
49465de
22ecabf
e00d4a6
2afb68e
07e0ddb
237dc7e
607daf9
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 |
---|---|---|
|
@@ -60,6 +60,35 @@ const userActions = { | |
}); | ||
}, | ||
|
||
receivedOrgSpacesToExtractSpaceUsers(orgSpaces) { | ||
const orgSpaceUsers = orgSpaces.map((orgSpace) => Promise.resolve( | ||
cfApi.fetchSpaceUserRoles(orgSpace.guid) | ||
)); | ||
return Promise.all(orgSpaceUsers); | ||
}, | ||
|
||
fetchUserAssociationsToOrgSpaces(userGuid, orgGuid) { | ||
return Promise.resolve(cfApi.fetchAllOrgSpaces(orgGuid)) | ||
.then((orgSpaces) => userActions.receivedOrgSpacesToExtractSpaceUsers(orgSpaces)); | ||
}, | ||
|
||
deleteUserIfNoSpaceAssociation(userGuid, orgGuid) { | ||
let usersSpaces; | ||
userActions.fetchUserAssociationsToOrgSpaces(userGuid, orgGuid) | ||
.then((spaceUsers) => { | ||
usersSpaces = spaceUsers.filter(spaceUser => spaceUser.guid === userGuid); | ||
if (usersSpaces.length > 0) { | ||
const description = 'This user can\'t be removed because they still have a space ' + | ||
'role within the organization. Please remove all space ' + | ||
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 natural response to "Please remove all space associations" is "How/where do I do that?" Let's add a link or a few words to point them in the right direction. |
||
'associations before removing this user from the organization. ' + | ||
'To review how, click the "Managing Teammates" link below.'; | ||
userActions.createUserSpaceAssociationNotification(description); | ||
} else { | ||
userActions.deleteUser(userGuid, orgGuid); | ||
} | ||
}); | ||
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. we need a catch here |
||
}, | ||
|
||
deleteUser(userGuid, orgGuid) { | ||
AppDispatcher.handleViewAction({ | ||
type: userActionTypes.USER_DELETE, | ||
|
@@ -198,12 +227,24 @@ const userActions = { | |
inviting ${email}`)); | ||
}, | ||
|
||
clearInviteNotifications() { | ||
clearUserListNotifications() { | ||
AppDispatcher.handleViewAction({ | ||
type: userActionTypes.USER_LIST_NOTICE_DISMISSED | ||
}); | ||
}, | ||
|
||
createUserListNotification(noticeType, description) { | ||
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. I think we should start writing new actions in this format:
Then every action presents a consistent interface regardless of the information being passed in. What do you think? 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. I think thats a good idea. It currently uses the ES6 syntax for exampling the variable name as the key. Instead of 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. i like the idea as well. but let's save that for a broader discussion. |
||
AppDispatcher.handleViewAction({ | ||
type: userActionTypes.USER_INVITE_STATUS_DISMISSED | ||
type: userActionTypes.USER_LIST_NOTICE_CREATED, | ||
noticeType, | ||
description | ||
}); | ||
}, | ||
|
||
createUserSpaceAssociationNotification(notification) { | ||
userActions.createUserListNotification('error', notification); | ||
}, | ||
|
||
createInviteNotification(verified, email) { | ||
let description; | ||
const noticeType = 'finish'; | ||
|
@@ -223,14 +264,10 @@ const userActions = { | |
'be controlled below.'; | ||
} | ||
|
||
AppDispatcher.handleViewAction({ | ||
type: userActionTypes.USER_INVITE_STATUS_DISPLAYED, | ||
noticeType, | ||
description | ||
}); | ||
userActions.createUserListNotification(noticeType, description); | ||
}, | ||
|
||
userInviteError(err, contextualMessage) { | ||
userListNoticeError(err, contextualMessage) { | ||
AppDispatcher.handleServerAction({ | ||
type: userActionTypes.USER_INVITE_ERROR, | ||
err, | ||
|
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.
I think these methods need some tests.
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.
Added!