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
a15b525a
Commit
a15b525a
authored
Mar 21, 2018
by
Lyza Danger Gardner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor `group-list`’s checking of share links
parent
29b8534d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
group-list.js
src/sidebar/components/group-list.js
+11
-0
group-list-test.js
src/sidebar/components/test/group-list-test.js
+16
-0
group-list.html
src/sidebar/templates/group-list.html
+1
-1
No files found.
src/sidebar/components/group-list.js
View file @
a15b525a
...
...
@@ -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 @
a15b525a
...
...
@@ -129,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 @
a15b525a
...
...
@@ -43,7 +43,7 @@
{{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.links.html}}"
target=
"_blank"
...
...
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