From f8c3faec7964ab7d7fb4ae5e44c09a5702e4cc20 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Sat, 9 Dec 2017 16:57:12 -0400 Subject: [PATCH] fix(GUI): only emit toggle drive event if drive is selectable (#1913) Right now we emit "Toggle drive" analytics events even when clicking on disable/unselectable drives. The fix is to move the `analytics.logEvent` inside the code path that applies if a drive selection is considered valid. Change-Type: patch Changelog-Entry: Don't send analytics events when attempting to toggle a disabled drive. Signed-off-by: Juan Cruz Viotti --- .../drive-selector/controllers/drive-selector.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/gui/components/drive-selector/controllers/drive-selector.js b/lib/gui/components/drive-selector/controllers/drive-selector.js index 2cc61249..48be1331 100644 --- a/lib/gui/components/drive-selector/controllers/drive-selector.js +++ b/lib/gui/components/drive-selector/controllers/drive-selector.js @@ -107,13 +107,13 @@ module.exports = function ( * }); */ this.toggleDrive = (drive) => { - analytics.logEvent('Toggle drive', { - drive, - previouslySelected: selectionState.isCurrentDrive(drive.device) - }) - return shouldChangeDriveSelectionState(drive).then((canChangeDriveSelectionState) => { if (canChangeDriveSelectionState) { + analytics.logEvent('Toggle drive', { + drive, + previouslySelected: selectionState.isCurrentDrive(drive.device) + }) + selectionState.toggleSetDrive(drive.device) } })