Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
liberty
host
Smilodon
Commits
1b447c19
Commit
1b447c19
authored
Nov 30, 2016
by
Eugen Rochko
Browse files
Preparing sensitive content for text
parent
a21bcac9
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/components/components/status_content.jsx
View file @
1b447c19
...
...
@@ -2,6 +2,8 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import
PureRenderMixin
from
'
react-addons-pure-render-mixin
'
;
import
emojify
from
'
../emoji
'
;
const
hideContent
=
str
=>
$
(
'
<p>
'
).
html
(
str
).
text
().
replace
(
/
[^\s]
/g
,
'
█
'
);
const
StatusContent
=
React
.
createClass
({
contextTypes
:
{
...
...
@@ -13,6 +15,12 @@ const StatusContent = React.createClass({
onClick
:
React
.
PropTypes
.
func
},
// getInitialState () {
// return {
// visible: false
// };
// },
mixins
:
[
PureRenderMixin
],
componentDidMount
()
{
...
...
@@ -57,8 +65,12 @@ const StatusContent = React.createClass({
},
render
()
{
const
content
=
{
__html
:
emojify
(
this
.
props
.
status
.
get
(
'
content
'
))
};
return
<
div
className
=
'status__content'
style
=
{
{
cursor
:
'
pointer
'
}
}
dangerouslySetInnerHTML
=
{
content
}
onClick
=
{
this
.
props
.
onClick
}
/>;
const
{
status
,
onClick
}
=
this
.
props
;
const
hidden
=
false
;
// (status.get('sensitive') && !this.state.visible);
const
content
=
{
__html
:
hidden
?
hideContent
(
status
.
get
(
'
content
'
))
:
emojify
(
status
.
get
(
'
content
'
))
};
return
<
div
className
=
'status__content'
style
=
{
{
cursor
:
'
pointer
'
,
color
:
hidden
?
'
#616b86
'
:
null
}
}
dangerouslySetInnerHTML
=
{
content
}
onClick
=
{
onClick
}
/>;
},
});
...
...
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