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
bcb8d9bc
Unverified
Commit
bcb8d9bc
authored
Mar 22, 2018
by
Robert Knight
Committed by
GitHub
Mar 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #698 from hypothesis/group-use-links-not-url
Remove reference to `group.url`
parents
bd831601
a15b525a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
group-list.js
src/sidebar/components/group-list.js
+11
-0
group-list-test.js
src/sidebar/components/test/group-list-test.js
+25
-3
group-list.html
src/sidebar/templates/group-list.html
+2
-2
No files found.
src/sidebar/components/group-list.js
View file @
bcb8d9bc
...
...
@@ -35,6 +35,17 @@ function GroupListController($window, analytics, groups, settings, serviceUrl) {
groups
.
focus
(
groupId
);
};
/**
* Show the share link for the group if it is not a third-party group
* AND if the URL needed is present in the group object. We should be able
* to simplify this once the API is adjusted only to return the link
* when applicable.
*/
this
.
shouldShowActivityLink
=
function
(
groupId
)
{
const
group
=
groups
.
get
(
groupId
);
return
group
.
links
&&
group
.
links
.
html
&&
!
this
.
isThirdPartyService
;
};
var
svc
=
serviceConfig
(
settings
);
if
(
svc
&&
svc
.
icon
)
{
this
.
thirdPartyGroupIcon
=
svc
.
icon
;
...
...
src/sidebar/components/test/group-list-test.js
View file @
bcb8d9bc
...
...
@@ -54,19 +54,25 @@ describe('groupList', function () {
groups
=
[{
id
:
'public'
,
links
:
{
html
:
OPEN_GROUP_LINK
,
},
name
:
'Public Group'
,
type
:
'open'
,
url
:
OPEN_GROUP_LINK
,
},{
id
:
'h-devs'
,
links
:
{
html
:
PRIVATE_GROUP_LINK
,
},
name
:
'Hypothesis Developers'
,
type
:
'private'
,
url
:
PRIVATE_GROUP_LINK
,
},
{
id
:
'restricto'
,
links
:
{
html
:
RESTRICTED_GROUP_LINK
,
},
name
:
'Hello Restricted'
,
type
:
'restricted'
,
url
:
RESTRICTED_GROUP_LINK
,
}];
fakeGroups
=
{
...
...
@@ -123,6 +129,22 @@ describe('groupList', function () {
assert
.
equal
(
link
[
2
].
href
,
RESTRICTED_GROUP_LINK
);
});
it
(
'should not render share links if they are not present'
,
function
()
{
groups
=
[
{
type
:
'private'
,
},
{
id
:
'anOpenGroup'
,
type
:
'open'
,
links
:
{},
},
];
var
element
=
createGroupList
();
var
links
=
element
.
find
(
'.share-link-container'
);
assert
.
equal
(
links
.
length
,
0
);
});
[{
// Logged-in third party user.
firstPartyAuthDomain
:
'example.com'
,
...
...
src/sidebar/templates/group-list.html
View file @
bcb8d9bc
...
...
@@ -43,9 +43,9 @@
{{group.name}}
</a>
</div>
<div
class=
"share-link-container"
ng-click=
"$event.stopPropagation()"
ng-if=
"
!vm.isThirdPartyService
"
>
<div
class=
"share-link-container"
ng-click=
"$event.stopPropagation()"
ng-if=
"
vm.shouldShowActivityLink(group.id)
"
>
<a
class=
"share-link"
href=
"{{group.
ur
l}}"
href=
"{{group.
links.htm
l}}"
target=
"_blank"
ng-click=
"vm.viewGroupActivity()"
>
View group activity
...
...
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