-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Allow listing user's projects when adding to an org #1119
Conversation
Will be used for adding users to org, and letting users add their own projects to an org.
Design decision from meeting: component will not make GQL query, but will be handed the list of projects in a prop. The "add member to org" dialog is doing a query on the user you select, so we'll edit that query in order to pull the user's project list and hand it to the component. The component will end up as a pure display component, which simply formats the data and presents a bindable prop for the checkbox group. |
Now takes list of projects and roles, and doesn't need to do any GQL queries of its own.
81d9ee9
to
d5d7c6f
Compare
This includes removing the list entirely if the user is deselected or the newly-selected user doesn't have any projects (e.g., Test Admin).
6eadf42
to
0751ecd
Compare
C# Unit Tests75 tests 75 ✅ 5s ⏱️ Results for commit c503366. ♻️ This comment has been updated with latest results. |
The lint failure is four lint errors all focused on the same line of code: await _addProjectsToOrg({ orgId, projectIds: [...withProjects.map(p => p.id)]})
I may just add a comment telling eslint to ignore errors on this line, since it's apparently not quite smart enough to figure out the types passing through the |
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.
Partial review, there's a couple things to change.
Co-authored-by: Kevin Hahn <[email protected]>
Permission check will already have thrown if the project ID doesn't exist — unless the calling user was a site admin, and site admins are not likely to be handcrafting GQL queries with invalid IDs.
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.
First thing I noticed is that the project list doesn't update when adding a member, should be able to be fixed be selecting the projects in the mutation.
I'm not sure where the bug is but when I try to add a user all their projects get added. Looking at the network it looks like all the id's are passed, so the backend is fine.
- type in user email and select, user is [email protected]
- all projects are selected because they're a manager
- use the checkbox at the top to uncheck all of them
- check sena 3
- submit
- go to project list and refresh
- all the projects from that user are in the list
Since addProjectsToOrg bails out immediately if the projects list is empty, this will not add significant time to the query if a user is being added with no projects at all.
Fix #1096.
When a user is selected from the typeahead in the "add members" modal on the org page, that user's projects are also shown in the modal, with any projects that the user manages automatically pre-checked. There's a new GraphQL mutation called AddProjectsToOrg (projects, plural) which will add all the projects at once.
The modal currently does not attempt to check which projects are already in the org; instead, the backend handles projects that are already in the org and doesn't try to add them again.
Screenshot: