From ec521e6bfc9d74cba363682665903638103babaa Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 13 Feb 2017 18:38:00 +0100 Subject: [PATCH] Add remote mentions warning when composing a private status --- .../compose/components/compose_form.jsx | 33 ++++++++++++------- .../containers/compose_form_container.jsx | 4 +++ .../javascripts/components/locales/en.jsx | 2 +- app/assets/stylesheets/components.scss | 15 +++++++++ 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/components/features/compose/components/compose_form.jsx b/app/assets/javascripts/components/features/compose/components/compose_form.jsx index 166c5fdce..9edc01ed7 100644 --- a/app/assets/javascripts/components/features/compose/components/compose_form.jsx +++ b/app/assets/javascripts/components/features/compose/components/compose_form.jsx @@ -36,6 +36,8 @@ const ComposeForm = React.createClass({ in_reply_to: ImmutablePropTypes.map, media_count: React.PropTypes.number, me: React.PropTypes.number, + needsPrivacyWarning: React.PropTypes.bool, + mentionedDomains: React.PropTypes.array.isRequired, onChange: React.PropTypes.func.isRequired, onSubmit: React.PropTypes.func.isRequired, onCancelReply: React.PropTypes.func.isRequired, @@ -117,16 +119,29 @@ const ComposeForm = React.createClass({ }, render () { - const { intl } = this.props; - let replyArea = ''; - let publishText = ''; - const disabled = this.props.is_submitting || this.props.is_uploading; + const { intl, needsPrivacyWarning, mentionedDomains } = this.props; + const disabled = this.props.is_submitting || this.props.is_uploading; + + let replyArea = ''; + let publishText = ''; + let privacyWarning = ''; + let reply_to_other = !!this.props.in_reply_to && (this.props.in_reply_to.getIn(['account', 'id']) !== this.props.me); if (this.props.in_reply_to) { replyArea = ; } - let reply_to_other = !!this.props.in_reply_to && (this.props.in_reply_to.getIn(['account', 'id']) !== this.props.me); + if (needsPrivacyWarning) { + privacyWarning = ( +
+ {mentionedDomains.join(', ')}, domainsCount: mentionedDomains.length }} + /> +
+ ); + } if (this.props.private) { publishText = {intl.formatMessage(messages.publish)}; @@ -142,6 +157,7 @@ const ComposeForm = React.createClass({ + {privacyWarning} {replyArea} - - - - } -