diff --git a/app/javascript/gabsocial/actions/user.js b/app/javascript/gabsocial/actions/user.js index 4e9f93a0..97ead2f4 100644 --- a/app/javascript/gabsocial/actions/user.js +++ b/app/javascript/gabsocial/actions/user.js @@ -11,7 +11,7 @@ export const SAVE_USER_PROFILE_INFORMATION_FETCH_SUCCESS = 'SAVE_USER_PROFILE_IN export const SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL = 'SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL' export const RESEND_USER_CONFIRMATION_EMAIL_SUCCESS = 'RESEND_USER_CONFIRMATION_EMAIL_SUCCESS' -export const saveUserProfileInformation = (data) => { +export const saveUserProfileInformation = (data, closer) => { return function (dispatch, getState) { if (!isObject(data) || !me) return @@ -31,6 +31,7 @@ export const saveUserProfileInformation = (data) => { }).then((response) => { dispatch(importFetchedAccount(response.data)) dispatch(saveUserProfileInformationSuccess(response.data)) + closer() }).catch(error => { dispatch(saveUserProfileInformationFail(error)) }) diff --git a/app/javascript/gabsocial/components/modal/edit_profile_modal.js b/app/javascript/gabsocial/components/modal/edit_profile_modal.js index 693a7e43..c2993d7c 100644 --- a/app/javascript/gabsocial/components/modal/edit_profile_modal.js +++ b/app/javascript/gabsocial/components/modal/edit_profile_modal.js @@ -98,8 +98,8 @@ class EditProfileModal extends ImmutablePureComponent { if (account.get('avatar_static') !== avatarSrc) obj.avatar = avatarSrc if (account.get('header_static') !== headerSrc) obj.header = headerSrc - this.props.onSave(obj) - this.handleOnClose() + this.props.onSave(obj, this.handleOnClose) + //this.handleOnClose() } render() { @@ -210,7 +210,7 @@ const mapStateToProps = (state) => ({ }) const mapDispatchToProps = (dispatch) => ({ - onSave: (data) => dispatch(saveUserProfileInformation(data)), + onSave: (data, closer) => dispatch(saveUserProfileInformation(data, closer)), }) EditProfileModal.propTypes = { diff --git a/app/javascript/gabsocial/reducers/user.js b/app/javascript/gabsocial/reducers/user.js index 3b23a7b1..d66dc8d1 100644 --- a/app/javascript/gabsocial/reducers/user.js +++ b/app/javascript/gabsocial/reducers/user.js @@ -19,6 +19,7 @@ export default function (state = initialState, action) { case SAVE_USER_PROFILE_INFORMATION_FETCH_SUCCESS: return state case SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL: + alert('Failed to update your profile. Max profile image size is 2MB. Please update and try again.') return state.set('isError', true) case RESEND_USER_CONFIRMATION_EMAIL_SUCCESS: return state.set('emailConfirmationResends', state.get('emailConfirmationResends') + 1)