mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-06 03:14:39 +08:00
fix(analytics): Fix send draft analytics
This commit is contained in:
parent
bc785c7b5d
commit
d1f9afba00
2 changed files with 14 additions and 3 deletions
|
@ -174,6 +174,7 @@ export default class SendDraftTask extends BaseDraftTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSuccess = () => {
|
onSuccess = () => {
|
||||||
|
Actions.recordUserEvent("Draft Sent")
|
||||||
Actions.sendDraftSuccess({message: this.message, messageClientId: this.message.clientId, draftClientId: this.draftClientId});
|
Actions.sendDraftSuccess({message: this.message, messageClientId: this.message.clientId, draftClientId: this.draftClientId});
|
||||||
NylasAPI.makeDraftDeletionRequest(this.draft);
|
NylasAPI.makeDraftDeletionRequest(this.draft);
|
||||||
|
|
||||||
|
@ -186,17 +187,27 @@ export default class SendDraftTask extends BaseDraftTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSendError = (err, retrySend) => {
|
onSendError = (err, retrySend) => {
|
||||||
|
let shouldRetry = false;
|
||||||
// If the message you're "replying to" has been deleted
|
// If the message you're "replying to" has been deleted
|
||||||
if (err.message && err.message.indexOf('Invalid message public id') === 0) {
|
if (err.message && err.message.indexOf('Invalid message public id') === 0) {
|
||||||
this.draft.replyToMessageId = null;
|
this.draft.replyToMessageId = null;
|
||||||
return retrySend();
|
shouldRetry = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the thread has been deleted
|
// If the thread has been deleted
|
||||||
if (err.message && err.message.indexOf('Invalid thread') === 0) {
|
if (err.message && err.message.indexOf('Invalid thread') === 0) {
|
||||||
this.draft.threadId = null;
|
this.draft.threadId = null;
|
||||||
this.draft.replyToMessageId = null;
|
this.draft.replyToMessageId = null;
|
||||||
return retrySend();
|
shouldRetry = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Actions.recordUserEvent("Draft Sending Errored", {
|
||||||
|
error: err.message,
|
||||||
|
shouldRetry: shouldRetry,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (shouldRetry) {
|
||||||
|
return retrySend()
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
|
|
2
src/pro
2
src/pro
|
@ -1 +1 @@
|
||||||
Subproject commit e6876cf0d6b14e8b7c5c68a29ce1a7735fe2e25e
|
Subproject commit 3df7fc1d17ccc0c6ab838baa27bedcb9083f716f
|
Loading…
Add table
Reference in a new issue