- Notifications
You must be signed in to change notification settings - Fork928
feat: ability to activate suspended users#2344
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -13,15 +13,20 @@ export const Language = { | ||
suspendDialogTitle: "Suspend user", | ||
suspendDialogAction: "Suspend", | ||
suspendDialogMessagePrefix: "Do you want to suspend the user", | ||
activateDialogTitle: "Activate user", | ||
activateDialogAction: "Activate", | ||
activateDialogMessagePrefix: "Do you want to activate the user", | ||
} | ||
export const UsersPage: React.FC = () => { | ||
const xServices = useContext(XServiceContext) | ||
const [usersState, usersSend] = useActor(xServices.usersXService) | ||
const [rolesState, rolesSend] = useActor(xServices.siteRolesXService) | ||
const { users, getUsersError, userIdToSuspend, userIdToActivate, userIdToResetPassword, newUserPassword } = | ||
usersState.context | ||
Contributor
| ||
const navigate = useNavigate() | ||
const userToBeSuspended = users?.find((u) => u.id === userIdToSuspend) | ||
const userToBeActivated = users?.find((u) => u.id === userIdToActivate) | ||
const userToResetPassword = users?.find((u) => u.id === userIdToResetPassword) | ||
const permissions = useSelector(xServices.authXService, selectPermissions) | ||
const canEditUsers = permissions && permissions.updateUsers | ||
@@ -62,6 +67,9 @@ export const UsersPage: React.FC = () => { | ||
onSuspendUser={(user) => { | ||
usersSend({ type: "SUSPEND_USER", userId: user.id }) | ||
}} | ||
onActivateUser={(user) => { | ||
usersSend({ type: "ACTIVATE_USER", userId: user.id }) | ||
}} | ||
onResetUserPassword={(user) => { | ||
usersSend({ type: "RESET_USER_PASSWORD", userId: user.id }) | ||
}} | ||
@@ -99,6 +107,26 @@ export const UsersPage: React.FC = () => { | ||
} | ||
/> | ||
<ConfirmDialog | ||
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 have a 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. good idea! | ||
type="success" | ||
hideCancel={false} | ||
open={usersState.matches("confirmUserActivation")} | ||
confirmLoading={usersState.matches("activatingUser")} | ||
title={Language.activateDialogTitle} | ||
confirmText={Language.activateDialogAction} | ||
onConfirm={() => { | ||
usersSend("CONFIRM_USER_ACTIVATION") | ||
}} | ||
onClose={() => { | ||
usersSend("CANCEL_USER_ACTIVATION") | ||
}} | ||
description={ | ||
<> | ||
{Language.activateDialogMessagePrefix} <strong>{userToBeActivated?.username}</strong>? | ||
</> | ||
} | ||
/> | ||
<ResetPasswordDialog | ||
loading={usersState.matches("resettingUserPassword")} | ||
user={userToResetPassword} | ||