Unverified Commit 0cdbc707 authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #1609 from hypothesis/remove-annotation-analytics

Remove analytics tracking from annotation component
parents 481aa74c 59dd0c9a
...@@ -32,7 +32,6 @@ function AnnotationController( ...@@ -32,7 +32,6 @@ function AnnotationController(
$scope, $scope,
$timeout, $timeout,
$window, $window,
analytics,
store, store,
annotationMapper, annotationMapper,
api, api,
...@@ -59,8 +58,6 @@ function AnnotationController( ...@@ -59,8 +58,6 @@ function AnnotationController(
} }
return saved.then(function(savedAnnot) { return saved.then(function(savedAnnot) {
let event;
// Copy across internal properties which are not part of the annotation // Copy across internal properties which are not part of the annotation
// model saved on the server // model saved on the server
savedAnnot.$tag = annot.$tag; savedAnnot.$tag = annot.$tag;
...@@ -70,26 +67,6 @@ function AnnotationController( ...@@ -70,26 +67,6 @@ function AnnotationController(
} }
}); });
if (self.isReply()) {
event = updating
? analytics.events.REPLY_UPDATED
: analytics.events.REPLY_CREATED;
} else if (self.isHighlight()) {
event = updating
? analytics.events.HIGHLIGHT_UPDATED
: analytics.events.HIGHLIGHT_CREATED;
} else if (isPageNote(self.annotation)) {
event = updating
? analytics.events.PAGE_NOTE_UPDATED
: analytics.events.PAGE_NOTE_CREATED;
} else {
event = updating
? analytics.events.ANNOTATION_UPDATED
: analytics.events.ANNOTATION_CREATED;
}
analytics.track(event);
return savedAnnot; return savedAnnot;
}); });
} }
...@@ -216,7 +193,6 @@ function AnnotationController( ...@@ -216,7 +193,6 @@ function AnnotationController(
flash.error(err.message, 'Flagging annotation failed'); flash.error(err.message, 'Flagging annotation failed');
}; };
annotationMapper.flagAnnotation(self.annotation).then(function() { annotationMapper.flagAnnotation(self.annotation).then(function() {
analytics.track(analytics.events.ANNOTATION_FLAGGED);
store.updateFlagStatus(self.annotation.id, true); store.updateFlagStatus(self.annotation.id, true);
}, onRejected); }, onRejected);
}; };
...@@ -231,25 +207,12 @@ function AnnotationController( ...@@ -231,25 +207,12 @@ function AnnotationController(
// Don't use confirm inside the digest cycle. // Don't use confirm inside the digest cycle.
const msg = 'Are you sure you want to delete this annotation?'; const msg = 'Are you sure you want to delete this annotation?';
if ($window.confirm(msg)) { if ($window.confirm(msg)) {
const onRejected = function(err) {
flash.error(err.message, 'Deleting annotation failed');
};
$scope.$apply(function() { $scope.$apply(function() {
annotationMapper.deleteAnnotation(self.annotation).then(function() { annotationMapper
let event; .deleteAnnotation(self.annotation)
.catch(err =>
if (self.isReply()) { flash.error(err.message, 'Deleting annotation failed')
event = analytics.events.REPLY_DELETED; );
} else if (self.isHighlight()) {
event = analytics.events.HIGHLIGHT_DELETED;
} else if (isPageNote(self.annotation)) {
event = analytics.events.PAGE_NOTE_DELETED;
} else {
event = analytics.events.ANNOTATION_DELETED;
}
analytics.track(event);
}, onRejected);
}); });
} }
}, true); }, true);
......
...@@ -83,7 +83,6 @@ describe('annotation', function() { ...@@ -83,7 +83,6 @@ describe('annotation', function() {
const fakeAccountID = { const fakeAccountID = {
isThirdPartyUser: sinon.stub(), isThirdPartyUser: sinon.stub(),
}; };
let fakeAnalytics;
let fakeAnnotationMapper; let fakeAnnotationMapper;
let fakeStore; let fakeStore;
let fakeFlash; let fakeFlash;
...@@ -161,11 +160,6 @@ describe('annotation', function() { ...@@ -161,11 +160,6 @@ describe('annotation', function() {
angular.mock.module(function($provide) { angular.mock.module(function($provide) {
sandbox = sinon.sandbox.create(); sandbox = sinon.sandbox.create();
fakeAnalytics = {
track: sandbox.stub(),
events: {},
};
fakeAnnotationMapper = { fakeAnnotationMapper = {
createAnnotation: sandbox.stub().returns({ createAnnotation: sandbox.stub().returns({
permissions: { permissions: {
...@@ -246,7 +240,6 @@ describe('annotation', function() { ...@@ -246,7 +240,6 @@ describe('annotation', function() {
call: sinon.stub(), call: sinon.stub(),
}; };
$provide.value('analytics', fakeAnalytics);
$provide.value('annotationMapper', fakeAnnotationMapper); $provide.value('annotationMapper', fakeAnnotationMapper);
$provide.value('store', fakeStore); $provide.value('store', fakeStore);
$provide.value('api', fakeApi); $provide.value('api', fakeApi);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment