-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* allow site moderators to promote other site moderators * add todo * allow modifying roles and scopes in one mutation * Complete the existing site moderator role management - Site moderators can promote new site moderators - Org mods can promote/demote commenters, staff, site mods - Admins can do anything they want CORL-1364 * Make it so user's can't reassign their own roles CORL-1364 * User GQLUSER_ROLE_RL generated types for roles CORL-1364 * Clean up guard clauses and auth directives CORL-1364 * Simplify viewer dependencies in UserRoleChange CORL-1364 * fix: changes to promote/demote flow * fix: revert changes to perm * fix: revert changes to updateRole * fix: revert changes to updateUserModerationScopes Co-authored-by: nick-funk <[email protected]> Co-authored-by: Wyatt Johnson <[email protected]> Co-authored-by: Wyatt Johnson <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
75ff141
commit 81bb55f
Showing
13 changed files
with
768 additions
and
31 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
src/core/client/admin/components/UserRole/DemoteUserMutation.ts
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,45 @@ | ||
import { graphql } from "react-relay"; | ||
import { Environment } from "relay-runtime"; | ||
|
||
import { | ||
commitMutationPromiseNormalized, | ||
createMutation, | ||
MutationInput, | ||
} from "coral-framework/lib/relay"; | ||
|
||
import { DemoteUserMutation as MutationTypes } from "coral-admin/__generated__/DemoteUserMutation.graphql"; | ||
|
||
let clientMutationId = 0; | ||
|
||
const DemoteUserMutation = createMutation( | ||
"demoteUser", | ||
(environment: Environment, input: MutationInput<MutationTypes>) => | ||
commitMutationPromiseNormalized<MutationTypes>(environment, { | ||
mutation: graphql` | ||
mutation DemoteUserMutation($input: DemoteUserInput!) { | ||
demoteUser(input: $input) { | ||
user { | ||
id | ||
role | ||
moderationScopes { | ||
scoped | ||
sites { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
clientMutationId | ||
} | ||
} | ||
`, | ||
variables: { | ||
input: { | ||
...input, | ||
clientMutationId: (clientMutationId++).toString(), | ||
}, | ||
}, | ||
}) | ||
); | ||
|
||
export default DemoteUserMutation; |
45 changes: 45 additions & 0 deletions
45
src/core/client/admin/components/UserRole/PromoteUserMutation.ts
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,45 @@ | ||
import { graphql } from "react-relay"; | ||
import { Environment } from "relay-runtime"; | ||
|
||
import { | ||
commitMutationPromiseNormalized, | ||
createMutation, | ||
MutationInput, | ||
} from "coral-framework/lib/relay"; | ||
|
||
import { PromoteUserMutation as MutationTypes } from "coral-admin/__generated__/PromoteUserMutation.graphql"; | ||
|
||
let clientMutationId = 0; | ||
|
||
const PromoteUserMutation = createMutation( | ||
"promoteUser", | ||
(environment: Environment, input: MutationInput<MutationTypes>) => | ||
commitMutationPromiseNormalized<MutationTypes>(environment, { | ||
mutation: graphql` | ||
mutation PromoteUserMutation($input: PromoteUserInput!) { | ||
promoteUser(input: $input) { | ||
user { | ||
id | ||
role | ||
moderationScopes { | ||
scoped | ||
sites { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
clientMutationId | ||
} | ||
} | ||
`, | ||
variables: { | ||
input: { | ||
...input, | ||
clientMutationId: (clientMutationId++).toString(), | ||
}, | ||
}, | ||
}) | ||
); | ||
|
||
export default PromoteUserMutation; |
10 changes: 10 additions & 0 deletions
10
src/core/client/admin/components/UserRole/SiteModeratorActions.css
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,10 @@ | ||
.button { | ||
width: 100%; | ||
justify-content: space-between; | ||
padding: 0; | ||
} | ||
|
||
.modal { | ||
max-width: 500px; | ||
padding: var(--spacing-2) var(--spacing-3) var(--spacing-3) var(--spacing-3); | ||
} |
Oops, something went wrong.