From 4ec598db81e0fafaeacf306eb5b41f3066b7fdf6 Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 10 Oct 2021 16:32:30 +0100 Subject: [PATCH] Hide edit profile button while editing, closes #301. Block UI when account edit request is sent, closes #303. --- .../intermediate/popovers/ModifyAccount.tsx | 6 ++++++ .../intermediate/popovers/UserProfile.tsx | 20 +++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/context/intermediate/popovers/ModifyAccount.tsx b/src/context/intermediate/popovers/ModifyAccount.tsx index 78b123ee..f47a5d06 100644 --- a/src/context/intermediate/popovers/ModifyAccount.tsx +++ b/src/context/intermediate/popovers/ModifyAccount.tsx @@ -38,6 +38,7 @@ export function ModifyAccountModal({ onClose, field }: Props) { new_email, new_password, }) => { + if (processing) return; setProcessing(true); try { @@ -74,6 +75,7 @@ export function ModifyAccountModal({ onClose, field }: Props) { disabled={processing} actions={[ { + disabled: processing, confirmation: true, onClick: handleSubmit(onSubmit), children: @@ -104,6 +106,7 @@ export function ModifyAccountModal({ onClose, field }: Props) { register={register} showOverline error={errors.new_email?.message} + disabled={processing} /> )} {field === "password" && ( @@ -114,6 +117,7 @@ export function ModifyAccountModal({ onClose, field }: Props) { showOverline error={errors.new_password?.message} autoComplete="new-password" + disabled={processing} /> )} {field === "username" && ( @@ -123,6 +127,7 @@ export function ModifyAccountModal({ onClose, field }: Props) { register={register} showOverline error={errors.new_username?.message} + disabled={processing} /> )} {error && ( diff --git a/src/context/intermediate/popovers/UserProfile.tsx b/src/context/intermediate/popovers/UserProfile.tsx index 2c20d3d6..af8192c2 100644 --- a/src/context/intermediate/popovers/UserProfile.tsx +++ b/src/context/intermediate/popovers/UserProfile.tsx @@ -185,16 +185,16 @@ export const UserProfile = observer( )} - {user.relationship === RelationshipStatus.User && ( - { - onClose?.(); - if (dummy) return; - history.push(`/settings/profile`); - }}> - - - )} + {user.relationship === RelationshipStatus.User && + !dummy && ( + { + onClose?.(); + history.push(`/settings/profile`); + }}> + + + )} {!user.bot && flags != 2 && flags != 4 &&