fix(analytics): Fix send draft analytics

This commit is contained in:
Evan Morikawa 2016-06-08 12:19:12 -07:00
parent bc785c7b5d
commit d1f9afba00
2 changed files with 14 additions and 3 deletions

View file

@ -174,6 +174,7 @@ export default class SendDraftTask extends BaseDraftTask {
}
onSuccess = () => {
Actions.recordUserEvent("Draft Sent")
Actions.sendDraftSuccess({message: this.message, messageClientId: this.message.clientId, draftClientId: this.draftClientId});
NylasAPI.makeDraftDeletionRequest(this.draft);
@ -186,17 +187,27 @@ export default class SendDraftTask extends BaseDraftTask {
}
onSendError = (err, retrySend) => {
let shouldRetry = false;
// If the message you're "replying to" has been deleted
if (err.message && err.message.indexOf('Invalid message public id') === 0) {
this.draft.replyToMessageId = null;
return retrySend();
shouldRetry = true
}
// If the thread has been deleted
if (err.message && err.message.indexOf('Invalid thread') === 0) {
this.draft.threadId = 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);

@ -1 +1 @@
Subproject commit e6876cf0d6b14e8b7c5c68a29ce1a7735fe2e25e
Subproject commit 3df7fc1d17ccc0c6ab838baa27bedcb9083f716f