From d1f9afba00c0231d62f6b6d074f4e9068af23c76 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Wed, 8 Jun 2016 12:19:12 -0700 Subject: [PATCH] fix(analytics): Fix send draft analytics --- src/flux/tasks/send-draft-task.es6 | 15 +++++++++++++-- src/pro | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/flux/tasks/send-draft-task.es6 b/src/flux/tasks/send-draft-task.es6 index b3305ac1e..c730b1f4b 100644 --- a/src/flux/tasks/send-draft-task.es6 +++ b/src/flux/tasks/send-draft-task.es6 @@ -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); diff --git a/src/pro b/src/pro index e6876cf0d..3df7fc1d1 160000 --- a/src/pro +++ b/src/pro @@ -1 +1 @@ -Subproject commit e6876cf0d6b14e8b7c5c68a29ce1a7735fe2e25e +Subproject commit 3df7fc1d17ccc0c6ab838baa27bedcb9083f716f