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
885ffcc4
Commit
885ffcc4
authored
Feb 10, 2017
by
Sheetal Umesh Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable the link to activity pages from user profile, if the user is a 3rd party account user.
parent
14bcd38b
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
80 additions
and
6 deletions
+80
-6
annotation.js
src/sidebar/directive/annotation.js
+5
-1
group-list.js
src/sidebar/directive/group-list.js
+7
-1
login-control.js
src/sidebar/directive/login-control.js
+6
-1
annotation-test.js
src/sidebar/directive/test/annotation-test.js
+6
-0
group-list-test.js
src/sidebar/directive/test/group-list-test.js
+7
-0
persona.js
src/sidebar/filter/persona.js
+14
-0
persona-test.js
src/sidebar/filter/test/persona-test.js
+14
-0
annotation.html
src/sidebar/templates/annotation.html
+5
-0
group_list.html
src/sidebar/templates/group_list.html
+1
-1
login_control.html
src/sidebar/templates/login_control.html
+5
-1
common.scss
src/styles/common.scss
+10
-1
No files found.
src/sidebar/directive/annotation.js
View file @
885ffcc4
...
@@ -49,7 +49,7 @@ function updateModel(annotation, changes, permissions) {
...
@@ -49,7 +49,7 @@ function updateModel(annotation, changes, permissions) {
function
AnnotationController
(
function
AnnotationController
(
$document
,
$q
,
$rootScope
,
$scope
,
$timeout
,
$window
,
analytics
,
annotationUI
,
$document
,
$q
,
$rootScope
,
$scope
,
$timeout
,
$window
,
analytics
,
annotationUI
,
annotationMapper
,
drafts
,
flash
,
features
,
groups
,
permissions
,
serviceUrl
,
annotationMapper
,
drafts
,
flash
,
features
,
groups
,
permissions
,
serviceUrl
,
session
,
store
,
streamer
)
{
session
,
s
ettings
,
s
tore
,
streamer
)
{
var
vm
=
this
;
var
vm
=
this
;
var
newlyCreatedByHighlightButton
;
var
newlyCreatedByHighlightButton
;
...
@@ -477,6 +477,10 @@ function AnnotationController(
...
@@ -477,6 +477,10 @@ function AnnotationController(
return
vm
.
annotation
.
user
;
return
vm
.
annotation
.
user
;
};
};
vm
.
isThirdPartyUser
=
function
()
{
return
persona
.
isThirdPartyUser
(
vm
.
annotation
.
user
,
settings
.
authDomain
);
};
vm
.
username
=
function
()
{
vm
.
username
=
function
()
{
return
persona
.
username
(
vm
.
annotation
.
user
);
return
persona
.
username
(
vm
.
annotation
.
user
);
};
};
...
...
src/sidebar/directive/group-list.js
View file @
885ffcc4
'use strict'
;
'use strict'
;
var
persona
=
require
(
'../filter/persona'
);
// @ngInject
// @ngInject
function
GroupListController
(
$scope
,
$window
,
groups
)
{
function
GroupListController
(
$scope
,
$window
,
groups
,
settings
)
{
$scope
.
isThirdPartyUser
=
function
()
{
return
persona
.
isThirdPartyUser
(
$scope
.
auth
.
userid
,
settings
.
authDomain
);
};
$scope
.
leaveGroup
=
function
(
groupId
)
{
$scope
.
leaveGroup
=
function
(
groupId
)
{
var
groupName
=
groups
.
get
(
groupId
).
name
;
var
groupName
=
groups
.
get
(
groupId
).
name
;
var
message
=
'Are you sure you want to leave the group "'
+
var
message
=
'Are you sure you want to leave the group "'
+
...
...
src/sidebar/directive/login-control.js
View file @
885ffcc4
'use strict'
;
'use strict'
;
var
persona
=
require
(
'../filter/persona'
);
module
.
exports
=
function
()
{
module
.
exports
=
function
()
{
return
{
return
{
bindToController
:
true
,
bindToController
:
true
,
controllerAs
:
'vm'
,
controllerAs
:
'vm'
,
//@ngInject
//@ngInject
controller
:
function
(
serviceUrl
)
{
controller
:
function
(
serviceUrl
,
settings
)
{
this
.
serviceUrl
=
serviceUrl
;
this
.
serviceUrl
=
serviceUrl
;
this
.
isThirdPartyUser
=
function
()
{
return
persona
.
isThirdPartyUser
(
this
.
auth
.
userid
,
settings
.
authDomain
);
};
},
},
restrict
:
'E'
,
restrict
:
'E'
,
scope
:
{
scope
:
{
...
...
src/sidebar/directive/test/annotation-test.js
View file @
885ffcc4
...
@@ -90,6 +90,7 @@ describe('annotation', function() {
...
@@ -90,6 +90,7 @@ describe('annotation', function() {
var
fakePermissions
;
var
fakePermissions
;
var
fakeServiceUrl
;
var
fakeServiceUrl
;
var
fakeSession
;
var
fakeSession
;
var
fakeSettings
;
var
fakeStore
;
var
fakeStore
;
var
fakeStreamer
;
var
fakeStreamer
;
var
sandbox
;
var
sandbox
;
...
@@ -186,6 +187,10 @@ describe('annotation', function() {
...
@@ -186,6 +187,10 @@ describe('annotation', function() {
get
:
function
()
{},
get
:
function
()
{},
};
};
fakeSettings
=
{
authDomain
:
'example.com'
,
};
fakeStore
=
{
fakeStore
=
{
annotation
:
{
annotation
:
{
create
:
sinon
.
spy
(
function
(
annot
)
{
create
:
sinon
.
spy
(
function
(
annot
)
{
...
@@ -211,6 +216,7 @@ describe('annotation', function() {
...
@@ -211,6 +216,7 @@ describe('annotation', function() {
$provide
.
value
(
'permissions'
,
fakePermissions
);
$provide
.
value
(
'permissions'
,
fakePermissions
);
$provide
.
value
(
'session'
,
fakeSession
);
$provide
.
value
(
'session'
,
fakeSession
);
$provide
.
value
(
'serviceUrl'
,
fakeServiceUrl
);
$provide
.
value
(
'serviceUrl'
,
fakeServiceUrl
);
$provide
.
value
(
'settings'
,
fakeSettings
);
$provide
.
value
(
'store'
,
fakeStore
);
$provide
.
value
(
'store'
,
fakeStore
);
$provide
.
value
(
'streamer'
,
fakeStreamer
);
$provide
.
value
(
'streamer'
,
fakeStreamer
);
}));
}));
...
...
src/sidebar/directive/test/group-list-test.js
View file @
885ffcc4
...
@@ -13,6 +13,7 @@ describe('groupList', function () {
...
@@ -13,6 +13,7 @@ describe('groupList', function () {
var
groups
;
var
groups
;
var
fakeGroups
;
var
fakeGroups
;
var
fakeServiceUrl
;
var
fakeServiceUrl
;
var
fakeSettings
;
before
(
function
()
{
before
(
function
()
{
angular
.
module
(
'app'
,
[])
angular
.
module
(
'app'
,
[])
...
@@ -24,8 +25,13 @@ describe('groupList', function () {
...
@@ -24,8 +25,13 @@ describe('groupList', function () {
beforeEach
(
function
()
{
beforeEach
(
function
()
{
fakeServiceUrl
=
sinon
.
stub
();
fakeServiceUrl
=
sinon
.
stub
();
fakeSettings
=
{
authDomain
:
'example.com'
,
};
angular
.
mock
.
module
(
'app'
,
{
angular
.
mock
.
module
(
'app'
,
{
serviceUrl
:
fakeServiceUrl
,
serviceUrl
:
fakeServiceUrl
,
settings
:
fakeSettings
,
});
});
});
});
...
@@ -61,6 +67,7 @@ describe('groupList', function () {
...
@@ -61,6 +67,7 @@ describe('groupList', function () {
return
util
.
createDirective
(
document
,
'groupList'
,
{
return
util
.
createDirective
(
document
,
'groupList'
,
{
auth
:
{
auth
:
{
status
:
'logged-in'
,
status
:
'logged-in'
,
userid
:
'acct:person@example.com'
,
},
},
});
});
}
}
...
...
src/sidebar/filter/persona.js
View file @
885ffcc4
...
@@ -30,7 +30,21 @@ function username(user) {
...
@@ -30,7 +30,21 @@ function username(user) {
return
account
.
username
;
return
account
.
username
;
}
}
/**
* Returns true if the authority is of a 3rd party user.
*/
function
isThirdPartyUser
(
user
,
authDomain
)
{
var
account
=
parseAccountID
(
user
);
if
(
!
account
)
{
return
false
;
}
return
account
.
provider
!==
authDomain
;
}
module
.
exports
=
{
module
.
exports
=
{
isThirdPartyUser
:
isThirdPartyUser
,
parseAccountID
:
parseAccountID
,
parseAccountID
:
parseAccountID
,
username
:
username
,
username
:
username
,
};
};
src/sidebar/filter/test/persona-test.js
View file @
885ffcc4
...
@@ -27,4 +27,18 @@ describe('persona', function () {
...
@@ -27,4 +27,18 @@ describe('persona', function () {
assert
.
equal
(
persona
.
username
(
'bogus'
),
''
);
assert
.
equal
(
persona
.
username
(
'bogus'
),
''
);
});
});
});
});
describe
(
'isThirdPartyUser'
,
function
()
{
it
(
'should return true if user is a third party user'
,
function
()
{
assert
.
isTrue
(
persona
.
isThirdPartyUser
(
'acct:someone@example.com'
,
'ex.com'
));
});
it
(
'should return false if user is not a third party user'
,
function
()
{
assert
.
isFalse
(
persona
.
isThirdPartyUser
(
'acct:someone@example.com'
,
'example.com'
));
});
it
(
'should return false if the user is invalid'
,
function
()
{
assert
.
isFalse
(
persona
.
isThirdPartyUser
(
'bogus'
,
'example.com'
));
});
});
});
});
src/sidebar/templates/annotation.html
View file @
885ffcc4
...
@@ -8,8 +8,13 @@
...
@@ -8,8 +8,13 @@
<span
ng-if=
"vm.user()"
>
<span
ng-if=
"vm.user()"
>
<a
class=
"annotation-header__user"
<a
class=
"annotation-header__user"
target=
"_blank"
target=
"_blank"
ng-if=
"!vm.isThirdPartyUser()"
ng-href=
"{{vm.serviceUrl('user',{user:vm.user()})}}"
ng-href=
"{{vm.serviceUrl('user',{user:vm.user()})}}"
>
{{vm.username()}}
</a>
>
{{vm.username()}}
</a>
<span
class=
"annotation-header__user"
target=
"_blank"
ng-if=
"vm.isThirdPartyUser()"
>
{{vm.username()}}
</span>
<span
class=
"annotation-collapsed-replies"
>
<span
class=
"annotation-collapsed-replies"
>
<a
class=
"annotation-link"
href=
""
<a
class=
"annotation-link"
href=
""
ng-click=
"vm.onReplyCountClick()"
ng-click=
"vm.onReplyCountClick()"
...
...
src/sidebar/templates/group_list.html
View file @
885ffcc4
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
</div>
</div>
</div>
</div>
</li>
</li>
<li
class=
"dropdown-menu__row dropdown-menu__row--unpadded new-group-btn"
>
<li
ng-if=
"!isThirdPartyUser()"
class=
"dropdown-menu__row dropdown-menu__row--unpadded new-group-btn"
>
<div
class=
"group-item"
ng-click=
"createNewGroup()"
>
<div
class=
"group-item"
ng-click=
"createNewGroup()"
>
<div
class=
"group-icon-container"
><i
class=
"h-icon-add"
></i></div>
<div
class=
"group-icon-container"
><i
class=
"h-icon-add"
></i></div>
<div
class=
"group-details"
>
<div
class=
"group-details"
>
...
...
src/sidebar/templates/login_control.html
View file @
885ffcc4
...
@@ -20,7 +20,11 @@
...
@@ -20,7 +20,11 @@
</a>
</a>
<ul
class=
"dropdown-menu pull-right"
role=
"menu"
>
<ul
class=
"dropdown-menu pull-right"
role=
"menu"
>
<li
class=
"dropdown-menu__row"
ng-if=
"vm.auth.status === 'logged-in'"
>
<li
class=
"dropdown-menu__row"
ng-if=
"vm.auth.status === 'logged-in'"
>
<a
href=
"{{vm.serviceUrl('user',{user: vm.auth.username})}}"
<span
ng-if=
"vm.isThirdPartyUser()"
class=
"dropdown-menu__link dropdown-menu__link--disabled"
target=
"_blank"
>
{{vm.auth.username}}
</span>
<a
ng-if=
"!vm.isThirdPartyUser()"
href=
"{{vm.serviceUrl('user',{user: vm.auth.username})}}"
class=
"dropdown-menu__link"
class=
"dropdown-menu__link"
title=
"View all your annotations"
title=
"View all your annotations"
target=
"_blank"
>
{{vm.auth.username}}
</a>
target=
"_blank"
>
{{vm.auth.username}}
</a>
...
...
src/styles/common.scss
View file @
885ffcc4
...
@@ -107,8 +107,17 @@ html {
...
@@ -107,8 +107,17 @@ html {
}
}
&
__link--subtle
{
&
__link--subtle
{
&
:hover
{
color
:
$color-gray
;
color
:
$color-gray
;
}
}
}
&
__link--disabled
{
&
:hover
{
cursor
:
default
;
color
:
inherit
;
}
}
// These psuedo-elements add the speech bubble tail / triangle.
// These psuedo-elements add the speech bubble tail / triangle.
&
:before
,
&
:after
{
&
:before
,
&
:after
{
...
...
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