From cab7603f5bc6756e261b63f262d090605ef5dd2b Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 10 Nov 2021 18:33:21 +0300 Subject: [PATCH] Fixed Bug 53415: Fixed save avatar click --- .../asc-web-components/avatar-editor/index.js | 22 +------------------ .../Section/Body/createUserForm.js | 5 ++++- .../Section/Body/updateUserForm.js | 5 +++-- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/packages/asc-web-components/avatar-editor/index.js b/packages/asc-web-components/avatar-editor/index.js index 5447358c930..35148d8a034 100644 --- a/packages/asc-web-components/avatar-editor/index.js +++ b/packages/asc-web-components/avatar-editor/index.js @@ -72,32 +72,14 @@ class AvatarEditor extends React.Component { }; onSaveButtonClick = () => { + this.props.onSave && this.props.onSave(); this.avatarEditorBodyRef.current.onSaveImage(); - //this.saveAvatar(); }; onCancelButtonClick = () => { this.props.onCancel(); }; - saveAvatar = () => { - if (!this.state.existImage) { - this.props.onSave(this.state.existImage); - return; - } - - this.props.onSave( - this.state.existImage, - { - x: this.state.x, - y: this.state.y, - width: this.state.width, - height: this.state.height, - }, - this.state.croppedImage - ); - }; - onClose = () => { this.setState({ visible: false }); this.props.onClose(); @@ -156,7 +138,6 @@ class AvatarEditor extends React.Component { onLoadFileError={this.onLoadFileError} onLoadFile={this.onLoadFile} deleteImage={this.onDeleteImage} - saveAvatar={this.saveAvatar} maxSize={maxSize * 1000000} // megabytes to bytes accept={accept} image={image} @@ -189,7 +170,6 @@ class AvatarEditor extends React.Component { onLoadFileError={this.onLoadFileError} onLoadFile={this.onLoadFile} deleteImage={this.onDeleteImage} - saveAvatar={this.saveAvatar} maxSize={maxSize * 1000000} // megabytes to bytes accept={accept} image={image} diff --git a/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createUserForm.js b/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createUserForm.js index f96233ad15c..d5faf87e7b7 100644 --- a/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createUserForm.js +++ b/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createUserForm.js @@ -442,6 +442,8 @@ class CreateUserForm extends React.Component { onValidateEmailField = (value) => this.setState({ errors: { ...this.state.errors, email: !value.isValid } }); + onSaveClick = () => this.setState({ isLoading: true }); + render() { const { isLoading, errors, profile, selector, isMobile } = this.state; const { @@ -480,7 +482,7 @@ class CreateUserForm extends React.Component { image={createdAvatar.image} visible={this.state.visibleAvatarEditor} onClose={this.onCloseAvatarEditor} - onSave={this.onSaveAvatar} + onSave={this.onSaveClick} onLoadFile={this.onLoadFileAvatar} headerLabel={t("AddPhoto")} selectNewPhotoLabel={t("Translations:selectNewPhotoLabel")} @@ -489,6 +491,7 @@ class CreateUserForm extends React.Component { maxSizeFileError={t("Translations:maxSizeFileError")} unknownError={t("Common:Error")} saveButtonLabel={t("Common:SaveButton")} + saveButtonLoading={this.state.isLoading} /> this.setState({ isLoading: true }); + render() { const { isLoading, @@ -735,7 +736,7 @@ class UpdateUserForm extends React.Component { image={this.state.avatar.image} visible={this.state.visibleAvatarEditor} onClose={this.onCloseAvatarEditor} - onSave={this.onSaveAvatar} + onSave={this.onSaveClick} onLoadFile={this.onLoadFileAvatar} headerLabel={t("EditPhoto")} selectNewPhotoLabel={t("Translations:selectNewPhotoLabel")}