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
9bdc066f
Unverified
Commit
9bdc066f
authored
Dec 06, 2017
by
Sean Hammond
Committed by
GitHub
Dec 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #623 from hypothesis/dont-link-tags-to-activity-pages-on-eLife
Don’t link tags to activity pages on eLife
parents
5cd296f8
adbd55fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
6 deletions
+44
-6
annotation.js
src/sidebar/components/annotation.js
+3
-0
annotation-test.js
src/sidebar/components/test/annotation-test.js
+41
-6
No files found.
src/sidebar/components/annotation.js
View file @
9bdc066f
...
...
@@ -444,6 +444,9 @@ function AnnotationController(
};
this
.
tagSearchURL
=
function
(
tag
)
{
if
(
this
.
isThirdPartyUser
())
{
return
null
;
}
return
serviceUrl
(
'search.tag'
,
{
tag
:
tag
});
};
...
...
src/sidebar/components/test/annotation-test.js
View file @
9bdc066f
...
...
@@ -1068,22 +1068,57 @@ describe('annotation', function() {
});
describe
(
'tag display'
,
function
()
{
it
(
'displays links to tags on the stream'
,
function
()
{
beforeEach
(
'make serviceUrl() return a URL for the tag'
,
function
()
{
fakeServiceUrl
.
withArgs
(
'search.tag'
,
{
tag
:
'atag'
})
.
returns
(
'https://test.hypothes.is/stream?q=tag:atag'
);
.
returns
(
'https://hypothes.is/search?q=tag:atag'
);
});
var
directive
=
createDirective
(
Object
.
assign
(
fixtures
.
defaultAnnotation
(),
{
/**
* Return an annotation directive with a single tag.
*/
function
annotationWithOneTag
()
{
return
createDirective
(
Object
.
assign
(
fixtures
.
defaultAnnotation
(),
{
tags
:
[
'atag'
],
}));
}
/**
* Return the one tag link element from the given annotation directive.
*/
function
tagLinkFrom
(
directive
)
{
var
links
=
[].
slice
.
apply
(
directive
.
element
[
0
].
querySelectorAll
(
'a'
));
var
tagLinks
=
links
.
filter
(
function
(
link
)
{
return
link
.
textContent
===
'atag'
;
});
assert
.
equal
(
tagLinks
.
length
,
1
);
assert
.
equal
(
tagLinks
[
0
].
href
,
'https://test.hypothes.is/stream?q=tag:atag'
);
return
tagLinks
[
0
];
}
context
(
'when the annotation is first-party'
,
function
()
{
beforeEach
(
'configure a first-party annotation'
,
function
()
{
fakeAccountID
.
isThirdPartyUser
.
returns
(
false
);
});
it
(
'displays links to tag search pages'
,
function
()
{
var
tagLink
=
tagLinkFrom
(
annotationWithOneTag
());
assert
.
equal
(
tagLink
.
href
,
'https://hypothes.is/search?q=tag:atag'
);
});
});
context
(
'when the annotation is third-party'
,
function
()
{
beforeEach
(
'configure a third-party annotation'
,
function
()
{
fakeAccountID
.
isThirdPartyUser
.
returns
(
true
);
});
it
(
"doesn't link tags for third-party annotations"
,
function
()
{
// Tag search pages aren't supported for third-party annotations in
// h, so we don't link to them in the client.
var
tagLink
=
tagLinkFrom
(
annotationWithOneTag
());
assert
.
isFalse
(
tagLink
.
hasAttribute
(
'href'
));
});
});
});
...
...
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