Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
0cdbc707
Unverified
Commit
0cdbc707
authored
Dec 19, 2019
by
Robert Knight
Committed by
GitHub
Dec 19, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1609 from hypothesis/remove-annotation-analytics
Remove analytics tracking from annotation component
parents
481aa74c
59dd0c9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
49 deletions
+5
-49
annotation.js
src/sidebar/components/annotation.js
+5
-42
annotation-test.js
src/sidebar/components/test/annotation-test.js
+0
-7
No files found.
src/sidebar/components/annotation.js
View file @
0cdbc707
...
@@ -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
);
...
...
src/sidebar/components/test/annotation-test.js
View file @
0cdbc707
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment