about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-07-31 12:06:56 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-07-31 05:06:56 +0200
commitbb85043f4641adbb4c9589ccd2bd93c9cdd06ce8 (patch)
tree1bd776ed4c038f7e98ba12af73aff1df9e143f76 /app/javascript/mastodon/features/compose/containers/sensitive_button_container.js
parente1fcad34a9e3c3fd22b3bee66b82d85bd03629fb (diff)
Disable sensitive button when with content warnings (#4460)
Diffstat (limited to 'app/javascript/mastodon/features/compose/containers/sensitive_button_container.js')
-rw-r--r--app/javascript/mastodon/features/compose/containers/sensitive_button_container.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js
index 63c0e8ae4..8624849f3 100644
--- a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js
+++ b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js
@@ -15,6 +15,7 @@ const messages = defineMessages({
 const mapStateToProps = state => ({
   visible: state.getIn(['compose', 'media_attachments']).size > 0,
   active: state.getIn(['compose', 'sensitive']),
+  disabled: state.getIn(['compose', 'spoiler']),
 });
 
 const mapDispatchToProps = dispatch => ({
@@ -30,12 +31,13 @@ class SensitiveButton extends React.PureComponent {
   static propTypes = {
     visible: PropTypes.bool,
     active: PropTypes.bool,
+    disabled: PropTypes.bool,
     onClick: PropTypes.func.isRequired,
     intl: PropTypes.object.isRequired,
   };
 
   render () {
-    const { visible, active, onClick, intl } = this.props;
+    const { visible, active, disabled, onClick, intl } = this.props;
 
     return (
       <Motion defaultStyle={{ scale: 0.87 }} style={{ scale: spring(visible ? 1 : 0.87, { stiffness: 200, damping: 3 }) }}>
@@ -53,6 +55,7 @@ class SensitiveButton extends React.PureComponent {
                 onClick={onClick}
                 size={18}
                 active={active}
+                disabled={disabled}
                 style={{ lineHeight: null, height: null }}
                 inverted
               />