-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bulk-add users to existing org (#887)
* Add GQL mutation for bulk-adding org members Most of this code is identical to the bulk-add code in ProjectMutations, but the org version explicitly does *not* invite members if an email address is not found. Instead, any usernames or emails not found are returned to the frontend so that the user can take appropriate action. * Add frontend UI to bulk-add members to orgs * Fix GraphQL invalidation Since the org page query asks for `orgById`, the GraphQL cache is caching the type OrgById rather than the type Organization. While we're at it, we also invalidate the OrgById cache for a few other mutations like adding and removing members from an org. And we stop asking for the mutation to return the list of org members, because the org admins don't have permission to access the .members field of orgs in normal queries, only in the orgById query. This stops the GraphQL permissions error that was popping up when org admins tried to do these operations. --------- Co-authored-by: Kevin Hahn <[email protected]>
- Loading branch information
Showing
10 changed files
with
328 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script lang="ts"> | ||
import { OrgRole } from '$lib/gql/types'; | ||
import FormatUserOrgRole from '../Orgs/FormatUserOrgRole.svelte'; | ||
import ActionBadge from './ActionBadge.svelte'; | ||
import Badge from './Badge.svelte'; | ||
export let member: { name: string; role: OrgRole }; | ||
export let canManage = false; | ||
export let type: 'existing' | 'new' = 'existing'; | ||
$: actionIcon = (type === 'existing' ? 'i-mdi-dots-vertical' as const : 'i-mdi-close' as const); | ||
$: variant = member.role === OrgRole.Admin ? 'btn-primary' as const : 'btn-secondary' as const; | ||
</script> | ||
|
||
<ActionBadge {actionIcon} {variant} disabled={!canManage} on:action> | ||
<span class="pr-3 whitespace-nowrap overflow-ellipsis overflow-x-clip" title={member.name}> | ||
{member.name} | ||
</span> | ||
|
||
<!-- justify the name left and the role right --> | ||
<span class="flex-grow" /> | ||
|
||
<Badge> | ||
<FormatUserOrgRole role={member.role} /> | ||
</Badge> | ||
</ActionBadge> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.