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
99e385b1
Commit
99e385b1
authored
Apr 20, 2017
by
Sean Hammond
Committed by
GitHub
Apr 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #362 from hypothesis/render-censored-text
Render "censored text" for hidden annotations
parents
d9a68167
c45738c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
9 deletions
+43
-9
annotation-test.js
src/sidebar/components/test/annotation-test.js
+25
-7
annotation.html
src/sidebar/templates/annotation.html
+2
-1
annotation.scss
src/styles/annotation.scss
+16
-1
No files found.
src/sidebar/components/test/annotation-test.js
View file @
99e385b1
...
...
@@ -1074,15 +1074,33 @@ describe('annotation', function() {
assert
.
equal
(
el
[
0
].
querySelector
(
'blockquote'
).
textContent
,
'<<-&->>'
);
});
it
(
'renders hidden annotations with a custom text class'
,
function
()
{
var
ann
=
fixtures
.
moderatedAnnotation
({
hidden
:
true
});
var
el
=
createDirective
(
ann
).
element
;
unroll
(
'renders hidden annotations with a custom text class (#context)'
,
function
(
testCase
)
{
var
el
=
createDirective
(
testCase
.
ann
).
element
;
assert
.
match
(
el
.
find
(
'markdown'
).
controller
(
'markdown'
),
sinon
.
match
({
customTextClass
:
{
'annotation-body is-hidden'
:
true
,
},
customTextClass
:
testCase
.
textClass
,
}));
});
},
[{
context
:
'for moderators'
,
ann
:
Object
.
assign
(
fixtures
.
moderatedAnnotation
({
hidden
:
true
}),
{
// Content still present.
text
:
'Some offensive content'
,
}),
textClass
:
{
'annotation-body is-hidden'
:
true
,
'has-content'
:
true
,
},
},{
context
:
'for non-moderators'
,
ann
:
Object
.
assign
(
fixtures
.
moderatedAnnotation
({
hidden
:
true
}),
{
// Content filtered out by service.
tags
:
[],
text
:
''
,
}),
textClass
:
{
'annotation-body is-hidden'
:
true
,
'has-content'
:
false
,
},
}]);
it
(
'flags the annotation when the user clicks the "Flag" button'
,
function
()
{
fakeAnnotationMapper
.
flagAnnotation
.
returns
(
Promise
.
resolve
());
...
...
src/sidebar/templates/annotation.html
View file @
99e385b1
...
...
@@ -39,7 +39,8 @@
overflow-hysteresis=
"20"
content-data=
"vm.state().text"
>
<markdown
text=
"vm.state().text"
custom-text-class=
"{'annotation-body is-hidden':vm.isHiddenByModerator()}"
custom-text-class=
"{'annotation-body is-hidden':vm.isHiddenByModerator(),
'has-content':vm.hasContent()}"
on-edit-text=
"vm.setText(text)"
read-only=
"!vm.editing()"
>
</markdown>
...
...
src/styles/annotation.scss
View file @
99e385b1
...
...
@@ -102,11 +102,26 @@
margin-left
:
0px
;
}
.annotation-body.is-hidden
{
// Hidden annotations displayed to moderators, where the content is still
// present.
.annotation-body.is-hidden.has-content
{
text-decoration
:
line-through
;
filter
:
grayscale
(
100%
)
contrast
(
65%
);
}
// Hidden annotations displayed to non-moderators, where the content has been
// filtered out by the service.
.annotation-body.is-hidden
:not
(
.has-content
)
{
// Create a column of horizontal stripes, giving the impression of text
// underneath that has been censored.
display
:
block
;
height
:
60px
;
background
:
repeating-linear-gradient
(
to
bottom
,
$grey-2
,
$grey-2
15px
,
white
15px
,
white
20px
);
}
// the footer at the bottom of an annotation displaying
// the annotation actions and reply counts
.annotation-footer
{
...
...
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