From 1b447c190eb47117e99ff1e3c754f9cc461202f1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 30 Nov 2016 16:10:19 +0100 Subject: [PATCH] Preparing sensitive content for text --- .../components/components/status_content.jsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/components/components/status_content.jsx b/app/assets/javascripts/components/components/status_content.jsx index eeb43a12c8..e755407418 100644 --- a/app/assets/javascripts/components/components/status_content.jsx +++ b/app/assets/javascripts/components/components/status_content.jsx @@ -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 => $('

').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

; + 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