diff --git a/client/src/backend/components/layout/DrawerHeader/index.js b/client/src/backend/components/layout/DrawerHeader/index.js index c9cbb652d9..eb39596834 100644 --- a/client/src/backend/components/layout/DrawerHeader/index.js +++ b/client/src/backend/components/layout/DrawerHeader/index.js @@ -14,7 +14,7 @@ export default class DrawerEntityHeader extends PureComponent { children: PropTypes.any, buttons: PropTypes.array, icon: PropTypes.string, - buttonLayout: PropTypes.oneOf(["stack", "inline"]), + buttonLayout: PropTypes.oneOf(["stack", "inline", "grid"]), small: PropTypes.bool, instructionsAreWarning: PropTypes.bool }; @@ -29,7 +29,7 @@ export default class DrawerEntityHeader extends PureComponent { } get inlineButtons() { - return this.props.buttonLayout !== "stack"; + return !this.props.buttonLayout || this.props.buttonLayout === "inline"; } render() { @@ -58,6 +58,7 @@ export default class DrawerEntityHeader extends PureComponent { {this.props.children} {this.props.buttons.length > 0 && ( + $grid && + `display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px;`} `; diff --git a/client/src/backend/containers/export-targets/__tests__/__snapshots__/Edit-test.js.snap b/client/src/backend/containers/export-targets/__tests__/__snapshots__/Edit-test.js.snap index 5814ed2da9..46304f44fe 100644 --- a/client/src/backend/containers/export-targets/__tests__/__snapshots__/Edit-test.js.snap +++ b/client/src/backend/containers/export-targets/__tests__/__snapshots__/Edit-test.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`backend/containers/Records/export-targets/Edit matches the snapshot when rendered 1`] = `"

test export target

"`; +exports[`backend/containers/Records/export-targets/Edit matches the snapshot when rendered 1`] = `"

test export target

"`; diff --git a/client/src/backend/containers/makers/__tests__/__snapshots__/Edit-test.js.snap b/client/src/backend/containers/makers/__tests__/__snapshots__/Edit-test.js.snap index 1fa4ccff2f..d5792a0f0c 100644 --- a/client/src/backend/containers/makers/__tests__/__snapshots__/Edit-test.js.snap +++ b/client/src/backend/containers/makers/__tests__/__snapshots__/Edit-test.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`backend/containers/makers/Edit matches the snapshot when rendered 1`] = `"

John Milton

"`; +exports[`backend/containers/makers/Edit matches the snapshot when rendered 1`] = `"

John Milton

"`; diff --git a/client/src/backend/containers/permission/__tests__/__snapshots__/Edit-test.js.snap b/client/src/backend/containers/permission/__tests__/__snapshots__/Edit-test.js.snap index 459a2753eb..48c0a2b630 100644 --- a/client/src/backend/containers/permission/__tests__/__snapshots__/Edit-test.js.snap +++ b/client/src/backend/containers/permission/__tests__/__snapshots__/Edit-test.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`backend/containers/permission/Edit matches the snapshot when rendered 1`] = `"

projects.permissions.edit_header

"`; +exports[`backend/containers/permission/Edit matches the snapshot when rendered 1`] = `"

projects.permissions.edit_header

"`; diff --git a/client/src/backend/containers/project-collection/__tests__/__snapshots__/Settings-test.js.snap b/client/src/backend/containers/project-collection/__tests__/__snapshots__/Settings-test.js.snap index 49f6e9eb1a..5b28e93b8d 100644 --- a/client/src/backend/containers/project-collection/__tests__/__snapshots__/Settings-test.js.snap +++ b/client/src/backend/containers/project-collection/__tests__/__snapshots__/Settings-test.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`backend/containers/project-collection/Settings matches the snapshot when rendered 1`] = `"

project_collections.manage

project_collections.collection_kind_instructions
actions.toggle_to_state
project_collections.short_description_instructions

forms.upload.instructions

gif, jpeg, jpg, png

project_collections.collection_icon_instructions

forms.upload.instructions

gif, jpeg, jpg, png

forms.upload.instructions

gif, jpeg, jpg, png

"`; +exports[`backend/containers/project-collection/Settings matches the snapshot when rendered 1`] = `"

project_collections.manage

project_collections.collection_kind_instructions
actions.toggle_to_state
project_collections.short_description_instructions

forms.upload.instructions

gif, jpeg, jpg, png

project_collections.collection_icon_instructions

forms.upload.instructions

gif, jpeg, jpg, png

forms.upload.instructions

gif, jpeg, jpg, png

"`; diff --git a/client/src/backend/containers/settings/subjects/__tests__/__snapshots__/Edit-test.js.snap b/client/src/backend/containers/settings/subjects/__tests__/__snapshots__/Edit-test.js.snap index d5c63405eb..8aa29afbfb 100644 --- a/client/src/backend/containers/settings/subjects/__tests__/__snapshots__/Edit-test.js.snap +++ b/client/src/backend/containers/settings/subjects/__tests__/__snapshots__/Edit-test.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`backend/containers/settings/subjects/Edit matches the snapshot when rendered 1`] = `"

Hip Hop

"`; +exports[`backend/containers/settings/subjects/Edit matches the snapshot when rendered 1`] = `"

Hip Hop

"`; diff --git a/client/src/backend/containers/twitter-query/__tests__/__snapshots__/Edit-test.js.snap b/client/src/backend/containers/twitter-query/__tests__/__snapshots__/Edit-test.js.snap index 4c4a6efc48..3e4862fbff 100644 --- a/client/src/backend/containers/twitter-query/__tests__/__snapshots__/Edit-test.js.snap +++ b/client/src/backend/containers/twitter-query/__tests__/__snapshots__/Edit-test.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`backend/containers/twitter-query/Edit matches the snapshot when rendered 1`] = `"
"`; +exports[`backend/containers/twitter-query/Edit matches the snapshot when rendered 1`] = `"
"`; diff --git a/client/src/backend/containers/users/Edit.js b/client/src/backend/containers/users/Edit.js index 3858078969..2ab3f33006 100644 --- a/client/src/backend/containers/users/Edit.js +++ b/client/src/backend/containers/users/Edit.js @@ -105,6 +105,24 @@ export class UsersEditContainer extends PureComponent { }); }; + verifyUser = () => { + const t = this.props.t; + const verified = this.user.attributes.admin_verified; + const heading = verified ? t("modals.unverify") : t("modals.verify"); + const message = verified + ? t("modals.unverify_body") + : t("modals.verify_body"); + this.props.confirm(heading, message, () => { + const adjustedUser = { ...this.user }; + adjustedUser.attributes.admin_verified = !verified; + + const call = usersAPI.update(this.user.id, adjustedUser); + const options = { notificationScope: "drawer" }; + const userRequest = request(call, requests.beUserUpdate, options); + return this.props.dispatch(userRequest); + }); + }; + closeResetDialog() { this.setState({ resetPassword: null }); } @@ -146,15 +164,22 @@ export class UsersEditContainer extends PureComponent { title={`${attr.firstName} ${attr.lastName}`} buttons={[ { - onClick: this.handleResetPasswordClick, - icon: "key32", - label: t("records.users.reset_password") + onClick: this.verifyUser, + icon: "privacy24", + label: user.attributes.admin_verified + ? t("records.users.block") + : t("records.users.verify") }, { onClick: this.unsubscribeUser, icon: "mail32", label: t("records.users.unsubscribe") }, + { + onClick: this.handleResetPasswordClick, + icon: "key32", + label: t("records.users.reset_password") + }, { onClick: this.handleUserDestroy, icon: "delete32", @@ -164,6 +189,7 @@ export class UsersEditContainer extends PureComponent { ]} instructions={t("records.users.not_established_warning")} instructionsAreWarning + buttonLayout="grid" />
diff --git a/client/src/backend/containers/users/__tests__/__snapshots__/Edit-test.js.snap b/client/src/backend/containers/users/__tests__/__snapshots__/Edit-test.js.snap index 1436dc3762..c78fc646ad 100644 --- a/client/src/backend/containers/users/__tests__/__snapshots__/Edit-test.js.snap +++ b/client/src/backend/containers/users/__tests__/__snapshots__/Edit-test.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`backend/containers/users/Edit matches the snapshot when rendered 1`] = `"

Rowan Ida

records.users.not_established_warning
"`; +exports[`backend/containers/users/Edit matches the snapshot when rendered 1`] = `"

Rowan Ida

records.users.not_established_warning
"`; diff --git a/client/src/config/app/locale/en-US/json/backend/records.json b/client/src/config/app/locale/en-US/json/backend/records.json index 15013a2029..2bd0ece1b5 100644 --- a/client/src/config/app/locale/en-US/json/backend/records.json +++ b/client/src/config/app/locale/en-US/json/backend/records.json @@ -32,6 +32,8 @@ "submit_label": "Save User", "unsubscribe": "Unsubscribe", "reset_password": "Reset Password", + "verify": "Verify", + "block": "Revoke Verification", "not_established_warning": "This user has not yet verified their email and will not be able to engage with public projects and reading groups." }, "pages": { diff --git a/client/src/config/app/locale/en-US/json/shared/modals.json b/client/src/config/app/locale/en-US/json/shared/modals.json index 372a4c21b3..41bce4a9a9 100644 --- a/client/src/config/app/locale/en-US/json/shared/modals.json +++ b/client/src/config/app/locale/en-US/json/shared/modals.json @@ -41,6 +41,10 @@ "thumbnail_change": "Changing this will remove the {{label}}'s current avatar image", "thumbnail_change_body": "Do you wish to proceed?", "unsubscribe": "Are you sure?", - "unsubscribe_body": "This user will be unsubscribed from all Manifold email notifications." + "unsubscribe_body": "This user will be unsubscribed from all Manifold email notifications.", + "unverify": "Are you sure you want to revoke verification?", + "unverify_body": "This user will no longer be able to annotate, comment, or create reading groups until they are verified by another admin or complete email verification.", + "verify": "Are you sure you want to verify this user?", + "verify_body": "Verified users can annotate and comment on Manifold texts and create public reading groups." } }