Hide edit profile button while editing, closes #301.

Block UI when account edit request is sent, closes #303.
This commit is contained in:
Paul 2021-10-10 16:32:30 +01:00
parent 89c0026fa2
commit 4ec598db81
2 changed files with 16 additions and 10 deletions

View file

@ -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}
/>
)}
<FormField
@ -131,6 +136,7 @@ export function ModifyAccountModal({ onClose, field }: Props) {
showOverline
error={errors.current_password?.message}
autoComplete="current-password"
disabled={processing}
/>
{error && (
<Overline type="error" error={error}>

View file

@ -185,16 +185,16 @@ export const UserProfile = observer(
</Tooltip>
</Localizer>
)}
{user.relationship === RelationshipStatus.User && (
<IconButton
onClick={() => {
onClose?.();
if (dummy) return;
history.push(`/settings/profile`);
}}>
<Edit size={28} />
</IconButton>
)}
{user.relationship === RelationshipStatus.User &&
!dummy && (
<IconButton
onClick={() => {
onClose?.();
history.push(`/settings/profile`);
}}>
<Edit size={28} />
</IconButton>
)}
{!user.bot &&
flags != 2 &&
flags != 4 &&