Skip to content

Commit 99956bf

Browse files
authored
Merge pull request #1444 from danieltigse/master
multiple bug fixes
2 parents a658522 + 1a16c5b commit 99956bf

21 files changed

+198
-76
lines changed

electron_app/src/windows/composer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ const destroy = async ({
155155
params = { threadId };
156156
} else if (
157157
type === composerEvents.REPLY ||
158-
type === composerEvents.REPLY_ALL
158+
type === composerEvents.REPLY_ALL ||
159+
type === composerEvents.FORWARD
159160
) {
160161
if (discard) {
161162
params.threadId = undefined;
@@ -180,7 +181,8 @@ const sendEventToMailbox = (eventName, data) => {
180181
};
181182

182183
const saveDraftToDatabase = async (composerId, data) => {
183-
const { accountId, accountEmail: username } = data;
184+
const { accountId, accountEmail: username, isEmpty } = data;
185+
if (isEmpty) return;
184186
const filteredRecipients = {
185187
from: data.recipients.from,
186188
to: filterInvalidEmailAddresses(data.recipients.to),

email_loading/src/components/SyncMailboxWrapper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,9 @@ class SyncMailboxWrapper extends Component {
214214
const { name, description } = string.errors.unableToConnect;
215215
throwError({
216216
name,
217-
description: description + statusCode
217+
description: `${description} ${statusCode}`
218218
});
219+
this.linkingDevicesThrowError();
219220
}
220221
};
221222

email_mailbox/src/actions/labels.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const removeLabels = labelIds => {
5959
export const removeLabel = (id, uuid) => {
6060
return async dispatch => {
6161
try {
62-
const response = await deleteLabelById(id);
62+
const response = await deleteLabelById({ id });
6363
if (!response) return;
6464
dispatch(removeLabelOnSuccess(id));
6565
const eventParams = {

email_mailbox/src/app.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,12 @@ h2{
763763
letter-spacing: 0.2px;
764764
}
765765
}
766+
767+
.loading-ring{
768+
margin-top: 28px;
769+
top: -26px;
770+
left: -10px;
771+
}
766772
}
767773
}
768774

email_mailbox/src/components/ChangePasswordPopup.js

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,34 @@ const InputErrorMessage = ({ hasError, errorMessage, value }) => {
107107

108108
const ChangePasswordPopupButtons = props => (
109109
<div className="popup-buttons">
110-
<button
111-
className="button-a popup-cancel-button"
112-
onClick={props.onTogglePopup}
113-
>
114-
<span>{string.popups.change_password.cancelButtonLabel}</span>
115-
</button>
116-
<button
117-
className="button-a popup-confirm-button"
118-
onClick={props.onConfirmChangePassword}
119-
disabled={props.isDisabledChangePasswordSubmitButton}
120-
>
121-
<span>{string.popups.change_password.confirmButtonLabel}</span>
122-
</button>
110+
{props.isLoading ? (
111+
<LoadingWheel />
112+
) : (
113+
<div>
114+
<button
115+
className="button-a popup-cancel-button"
116+
onClick={props.onTogglePopup}
117+
>
118+
<span>{string.popups.change_password.cancelButtonLabel}</span>
119+
</button>
120+
<button
121+
className="button-a popup-confirm-button"
122+
onClick={props.onConfirmChangePassword}
123+
disabled={props.isDisabledChangePasswordSubmitButton}
124+
>
125+
<span>{string.popups.change_password.confirmButtonLabel}</span>
126+
</button>
127+
</div>
128+
)}
129+
</div>
130+
);
131+
132+
const LoadingWheel = () => (
133+
<div className="loading-ring">
134+
<div />
135+
<div />
136+
<div />
137+
<div />
123138
</div>
124139
);
125140

@@ -146,6 +161,7 @@ ChangePasswordPopupInput.propTypes = {
146161

147162
ChangePasswordPopupButtons.propTypes = {
148163
isDisabledChangePasswordSubmitButton: PropTypes.bool,
164+
isLoading: PropTypes.bool,
149165
onConfirmChangePassword: PropTypes.func,
150166
onTogglePopup: PropTypes.func
151167
};

email_mailbox/src/components/RemoveDevicePopup.js

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,39 @@ const RemoveDevicePopup = props => {
1919
<PasswordChangedPopupInput {...props} />
2020
</div>
2121
<div className="popup-buttons">
22-
<button
23-
className="button-a popup-cancel-button"
24-
onClick={props.onClickCancelRemoveDevice}
25-
>
26-
<span>{string.popups.remove_device.cancelButtonLabel}</span>
27-
</button>
28-
<button
29-
className="button-a popup-confirm-button"
30-
onClick={props.onClickConfirmRemoveDevice}
31-
disabled={props.isDisabledConfirmButton}
32-
>
33-
<span>{string.popups.remove_device.confirmButtonLabel}</span>
34-
</button>
22+
{props.isLoading ? (
23+
<LoadingWheel />
24+
) : (
25+
<div>
26+
<button
27+
className="button-a popup-cancel-button"
28+
onClick={props.onClickCancelRemoveDevice}
29+
>
30+
<span>{string.popups.remove_device.cancelButtonLabel}</span>
31+
</button>
32+
<button
33+
className="button-a popup-confirm-button"
34+
onClick={props.onClickConfirmRemoveDevice}
35+
disabled={props.isDisabledConfirmButton}
36+
>
37+
<span>{string.popups.remove_device.confirmButtonLabel}</span>
38+
</button>
39+
</div>
40+
)}
3541
</div>
3642
</div>
3743
);
3844
};
3945

46+
const LoadingWheel = () => (
47+
<div className="loading-ring">
48+
<div />
49+
<div />
50+
<div />
51+
<div />
52+
</div>
53+
);
54+
4055
const PasswordChangedPopupInput = ({
4156
type,
4257
value,
@@ -90,6 +105,7 @@ PasswordChangedPopupInput.propTypes = {
90105

91106
RemoveDevicePopup.propTypes = {
92107
isDisabledConfirmButton: PropTypes.bool,
108+
isLoading: PropTypes.bool,
93109
onClickCancelRemoveDevice: PropTypes.func,
94110
onClickConfirmRemoveDevice: PropTypes.func
95111
};

email_mailbox/src/components/RemoveDevicePopupWrapper.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class RemoveDevicePopupWrapper extends Component {
1616
icon: 'icon-not-show',
1717
value: '',
1818
errorMessage: '',
19-
hasError: false
19+
hasError: false,
20+
isLoading: false
2021
};
2122
}
2223

@@ -30,6 +31,7 @@ class RemoveDevicePopupWrapper extends Component {
3031
value={this.state.value}
3132
errorMessage={this.state.errorMessage}
3233
hasError={this.state.hasError}
34+
isLoading={this.state.isLoading}
3335
onChangeInputValue={this.handleChangeInputValue}
3436
onClickCancelPasswordChanged={this.handleClickCancelPasswordChanged}
3537
onClickChangeInputType={this.handleClickChangeInputType}
@@ -68,12 +70,14 @@ class RemoveDevicePopupWrapper extends Component {
6870
this.setState({ type, icon });
6971
};
7072

71-
handleClickConfirmRemoveDevice = () => {
73+
handleClickConfirmRemoveDevice = async () => {
7274
const params = {
7375
deviceId: this.props.deviceId,
7476
password: hashPassword(this.state.value)
7577
};
76-
this.props.onDeviceToRemove(params);
78+
this.setState({ isLoading: true });
79+
const isSuccess = await this.props.onDeviceToRemove(params);
80+
if (!isSuccess) this.setState({ isLoading: false });
7781
};
7882
}
7983

email_mailbox/src/components/SetReplyToEmailPopup.js

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,34 @@ const InputErrorMessage = ({ hasError, errorMessage, value }) => {
5656

5757
const SetReplyToEmailPopupButtons = props => (
5858
<div className="popup-buttons">
59-
<button
60-
className="button-a popup-cancel-button"
61-
onClick={props.onTogglePopup}
62-
>
63-
<span>{string.popups.set_reply_to.cancelButtonLabel}</span>
64-
</button>
65-
<button
66-
className="button-a popup-confirm-button"
67-
onClick={props.onConfirmSetReplyTo}
68-
disabled={props.isDisabledSetReplyToSubmitButton}
69-
>
70-
<span>{string.popups.set_reply_to.confirmButtonLabel}</span>
71-
</button>
59+
{props.isLoading ? (
60+
<LoadingWheel />
61+
) : (
62+
<div>
63+
<button
64+
className="button-a popup-cancel-button"
65+
onClick={props.onTogglePopup}
66+
>
67+
<span>{string.popups.set_reply_to.cancelButtonLabel}</span>
68+
</button>
69+
<button
70+
className="button-a popup-confirm-button"
71+
onClick={props.onConfirmSetReplyTo}
72+
disabled={props.isDisabledSetReplyToSubmitButton}
73+
>
74+
<span>{string.popups.set_reply_to.confirmButtonLabel}</span>
75+
</button>
76+
</div>
77+
)}
78+
</div>
79+
);
80+
81+
const LoadingWheel = () => (
82+
<div className="loading-ring">
83+
<div />
84+
<div />
85+
<div />
86+
<div />
7287
</div>
7388
);
7489

@@ -82,7 +97,8 @@ SetReplyToPopupInput.propTypes = {
8297
SetReplyToEmailPopupButtons.propTypes = {
8398
onTogglePopup: PropTypes.func,
8499
onConfirmSetReplyTo: PropTypes.func,
85-
isDisabledSetReplyToSubmitButton: PropTypes.bool
100+
isDisabledSetReplyToSubmitButton: PropTypes.bool,
101+
isLoading: PropTypes.bool
86102
};
87103

88104
SetReplyToEmailPopup.propTypes = {

email_mailbox/src/components/SettingAccountWrapper.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,17 @@ class SettingAccountWrapper extends Component {
723723
this.state.changePasswordPopupParams.newPasswordInput.value
724724
)
725725
};
726+
this.setState({
727+
changePasswordPopupParams: {
728+
...this.state.changePasswordPopupParams,
729+
isLoading: true
730+
}
731+
});
726732
const { status } = await changePassword(params);
727733
if (status === 400) {
728734
const changePasswordPopupParams = {
729735
...this.state.changePasswordPopupParams,
736+
isLoading: false,
730737
oldPasswordInput: {
731738
...this.state.changePasswordPopupParams.oldPasswordInput,
732739
hasError: true,
@@ -741,13 +748,26 @@ class SettingAccountWrapper extends Component {
741748
this.handleClearPopupParams(SETTINGS_POPUP_TYPES.CHANGE_PASSWORD);
742749
return;
743750
}
751+
this.setState({
752+
changePasswordPopupParams: {
753+
...this.state.changePasswordPopupParams,
754+
isLoading: false
755+
}
756+
});
744757
sendChangePasswordErrorMessage();
745758
};
746759

747760
handleConfirmSetReplyTo = async () => {
748761
const email = this.state.setReplyToPopupParams.replyToInput.email;
749762
const SUCCESS_STATUS = 200;
750763

764+
this.setState({
765+
setReplyToPopupParams: {
766+
...this.state.setReplyToPopupParams,
767+
isLoading: true
768+
}
769+
});
770+
751771
const { status } = await setReplyTo({
752772
enable: true,
753773
address: email
@@ -782,6 +802,7 @@ class SettingAccountWrapper extends Component {
782802
settingsPopupType: SETTINGS_POPUP_TYPES.NONE,
783803
setReplyToPopupParams: {
784804
isDisabledSubmitButton: true,
805+
isLoading: false,
785806
replyToInput: {
786807
email: this.state.replyToParams.replyToEmail,
787808
hasError: false,

email_mailbox/src/components/SettingDevicesWrapper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class SettingDevicesWrapper extends Component {
5656
} else {
5757
sendRemoveDeviceErrorMessage();
5858
}
59+
return isSuccess;
5960
};
6061
}
6162

0 commit comments

Comments
 (0)