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
238a1d2c
Commit
238a1d2c
authored
May 25, 2017
by
Sean Roberts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding group leave, switch, and view activity metrics
parent
4beda4fa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
2 deletions
+48
-2
analytics.js
src/sidebar/analytics.js
+3
-0
group-list.js
src/sidebar/components/group-list.js
+7
-1
group-list-test.js
src/sidebar/components/test/group-list-test.js
+34
-0
group-list.html
src/sidebar/templates/group-list.html
+4
-1
No files found.
src/sidebar/analytics.js
View file @
238a1d2c
...
@@ -64,6 +64,9 @@ function analytics($analytics, $window, settings) {
...
@@ -64,6 +64,9 @@ function analytics($analytics, $window, settings) {
ANNOTATION_SHARED
:
'annotationShared'
,
ANNOTATION_SHARED
:
'annotationShared'
,
ANNOTATION_UPDATED
:
'annotationUpdated'
,
ANNOTATION_UPDATED
:
'annotationUpdated'
,
DOCUMENT_SHARED
:
'documentShared'
,
DOCUMENT_SHARED
:
'documentShared'
,
GROUP_LEAVE
:
'groupLeave'
,
GROUP_SWITCH
:
'groupSwitch'
,
GROUP_VIEW_ACTIVITY
:
'groupViewActivity'
,
HIGHLIGHT_CREATED
:
'highlightCreated'
,
HIGHLIGHT_CREATED
:
'highlightCreated'
,
HIGHLIGHT_UPDATED
:
'highlightUpdated'
,
HIGHLIGHT_UPDATED
:
'highlightUpdated'
,
HIGHLIGHT_DELETED
:
'highlightDeleted'
,
HIGHLIGHT_DELETED
:
'highlightDeleted'
,
...
...
src/sidebar/components/group-list.js
View file @
238a1d2c
...
@@ -4,7 +4,7 @@ var persona = require('../filter/persona');
...
@@ -4,7 +4,7 @@ var persona = require('../filter/persona');
var
serviceConfig
=
require
(
'../service-config'
);
var
serviceConfig
=
require
(
'../service-config'
);
// @ngInject
// @ngInject
function
GroupListController
(
$window
,
groups
,
settings
,
serviceUrl
)
{
function
GroupListController
(
$window
,
analytics
,
groups
,
settings
,
serviceUrl
)
{
this
.
groups
=
groups
;
this
.
groups
=
groups
;
this
.
createNewGroup
=
function
()
{
this
.
createNewGroup
=
function
()
{
...
@@ -20,11 +20,17 @@ function GroupListController($window, groups, settings, serviceUrl) {
...
@@ -20,11 +20,17 @@ function GroupListController($window, groups, settings, serviceUrl) {
var
message
=
'Are you sure you want to leave the group "'
+
var
message
=
'Are you sure you want to leave the group "'
+
groupName
+
'"?'
;
groupName
+
'"?'
;
if
(
$window
.
confirm
(
message
))
{
if
(
$window
.
confirm
(
message
))
{
analytics
.
track
(
analytics
.
events
.
GROUP_LEAVE
);
groups
.
leave
(
groupId
);
groups
.
leave
(
groupId
);
}
}
};
};
this
.
viewGroupActivity
=
function
()
{
analytics
.
track
(
analytics
.
events
.
GROUP_VIEW_ACTIVITY
);
};
this
.
focusGroup
=
function
(
groupId
)
{
this
.
focusGroup
=
function
(
groupId
)
{
analytics
.
track
(
analytics
.
events
.
GROUP_SWITCH
);
groups
.
focus
(
groupId
);
groups
.
focus
(
groupId
);
};
};
...
...
src/sidebar/components/test/group-list-test.js
View file @
238a1d2c
...
@@ -12,6 +12,7 @@ describe('groupList', function () {
...
@@ -12,6 +12,7 @@ describe('groupList', function () {
var
groups
;
var
groups
;
var
fakeGroups
;
var
fakeGroups
;
var
fakeAnalytics
;
var
fakeServiceUrl
;
var
fakeServiceUrl
;
var
fakeSettings
;
var
fakeSettings
;
...
@@ -24,12 +25,23 @@ describe('groupList', function () {
...
@@ -24,12 +25,23 @@ describe('groupList', function () {
});
});
beforeEach
(
function
()
{
beforeEach
(
function
()
{
fakeAnalytics
=
{
track
:
sinon
.
stub
(),
events
:
{
GROUP_LEAVE
:
'groupLeave'
,
GROUP_SWITCH
:
'groupSwitch'
,
GROUP_VIEW_ACTIVITY
:
'groupViewActivity'
,
},
};
fakeServiceUrl
=
sinon
.
stub
();
fakeServiceUrl
=
sinon
.
stub
();
fakeSettings
=
{
fakeSettings
=
{
authDomain
:
'example.com'
,
authDomain
:
'example.com'
,
};
};
angular
.
mock
.
module
(
'app'
,
{
angular
.
mock
.
module
(
'app'
,
{
analytics
:
fakeAnalytics
,
serviceUrl
:
fakeServiceUrl
,
serviceUrl
:
fakeServiceUrl
,
settings
:
fakeSettings
,
settings
:
fakeSettings
,
});
});
...
@@ -88,6 +100,13 @@ describe('groupList', function () {
...
@@ -88,6 +100,13 @@ describe('groupList', function () {
assert
.
equal
(
link
[
0
].
href
,
GROUP_LINK
);
assert
.
equal
(
link
[
0
].
href
,
GROUP_LINK
);
});
});
it
(
'should track metrics when a user attempts to view a groups activity'
,
function
()
{
var
element
=
createGroupList
();
var
link
=
element
.
find
(
'.share-link'
);
link
.
click
();
assert
.
calledWith
(
fakeAnalytics
.
track
,
fakeAnalytics
.
events
.
GROUP_VIEW_ACTIVITY
);
});
function
clickLeaveIcon
(
element
,
acceptPrompt
)
{
function
clickLeaveIcon
(
element
,
acceptPrompt
)
{
var
leaveLink
=
element
.
find
(
'.h-icon-cancel-outline'
);
var
leaveLink
=
element
.
find
(
'.h-icon-cancel-outline'
);
...
@@ -102,18 +121,32 @@ describe('groupList', function () {
...
@@ -102,18 +121,32 @@ describe('groupList', function () {
var
element
=
createGroupList
();
var
element
=
createGroupList
();
clickLeaveIcon
(
element
,
true
);
clickLeaveIcon
(
element
,
true
);
assert
.
ok
(
fakeGroups
.
leave
.
calledWith
(
'h-devs'
));
assert
.
ok
(
fakeGroups
.
leave
.
calledWith
(
'h-devs'
));
assert
.
calledWith
(
fakeAnalytics
.
track
,
fakeAnalytics
.
events
.
GROUP_LEAVE
);
});
});
it
(
'should not leave group when confirmation is dismissed'
,
function
()
{
it
(
'should not leave group when confirmation is dismissed'
,
function
()
{
var
element
=
createGroupList
();
var
element
=
createGroupList
();
clickLeaveIcon
(
element
,
false
);
clickLeaveIcon
(
element
,
false
);
assert
.
notCalled
(
fakeGroups
.
leave
);
assert
.
notCalled
(
fakeGroups
.
leave
);
assert
.
notCalled
(
fakeAnalytics
.
track
);
});
});
it
(
'should not change the focused group when leaving'
,
function
()
{
it
(
'should not change the focused group when leaving'
,
function
()
{
var
element
=
createGroupList
();
var
element
=
createGroupList
();
clickLeaveIcon
(
element
,
true
);
clickLeaveIcon
(
element
,
true
);
assert
.
notCalled
(
fakeGroups
.
focus
);
assert
.
notCalled
(
fakeGroups
.
focus
);
assert
.
calledWith
(
fakeAnalytics
.
track
,
fakeAnalytics
.
events
.
GROUP_LEAVE
);
});
it
(
'should change current group focus when click another group'
,
function
()
{
var
element
=
createGroupList
();
var
groupItems
=
element
.
find
(
'.group-item'
);
// click the second group
groupItems
[
1
].
click
();
assert
.
calledOnce
(
fakeGroups
.
focus
);
assert
.
calledWith
(
fakeAnalytics
.
track
,
fakeAnalytics
.
events
.
GROUP_SWITCH
);
});
});
it
(
'should open a window when "New Group" is clicked'
,
function
()
{
it
(
'should open a window when "New Group" is clicked'
,
function
()
{
...
@@ -123,6 +156,7 @@ describe('groupList', function () {
...
@@ -123,6 +156,7 @@ describe('groupList', function () {
var
element
=
createGroupList
();
var
element
=
createGroupList
();
$window
.
open
=
sinon
.
stub
();
$window
.
open
=
sinon
.
stub
();
var
newGroupLink
=
var
newGroupLink
=
element
[
0
].
querySelector
(
'.new-group-btn a'
);
element
[
0
].
querySelector
(
'.new-group-btn a'
);
angular
.
element
(
newGroupLink
).
click
();
angular
.
element
(
newGroupLink
).
click
();
...
...
src/sidebar/templates/group-list.html
View file @
238a1d2c
...
@@ -58,7 +58,10 @@
...
@@ -58,7 +58,10 @@
</a>
</a>
</div>
</div>
<div
class=
"share-link-container"
ng-click=
"$event.stopPropagation()"
ng-if=
"!group.public"
>
<div
class=
"share-link-container"
ng-click=
"$event.stopPropagation()"
ng-if=
"!group.public"
>
<a
class=
"share-link"
href=
"{{group.url}}"
target=
"_blank"
>
<a
class=
"share-link"
href=
"{{group.url}}"
target=
"_blank"
ng-click=
"vm.viewGroupActivity()"
>
View group activity and invite others
View group activity and invite others
</a>
</a>
</div>
</div>
...
...
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