about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/status_content.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-03-28 15:40:34 +0200
committerThibaut Girka <thib@sitedethib.com>2018-04-22 19:18:15 +0200
commit2888f74c1219e53e0aca28263ea8289d17264c21 (patch)
tree214cb47a59e84125dbb363c911fd152a32af66f9 /app/javascript/flavours/glitch/components/status_content.js
parent259bc9840b061fa466b203035b2941efd5a8907f (diff)
Refactor the infamous three-valued boolean into two booleans, trying to simplify the logic
Diffstat (limited to 'app/javascript/flavours/glitch/components/status_content.js')
-rw-r--r--app/javascript/flavours/glitch/components/status_content.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js
index 3bb3c7a12..26d5b7c0f 100644
--- a/app/javascript/flavours/glitch/components/status_content.js
+++ b/app/javascript/flavours/glitch/components/status_content.js
@@ -11,6 +11,7 @@ export default class StatusContent extends React.PureComponent {
   static propTypes = {
     status: ImmutablePropTypes.map.isRequired,
     expanded: PropTypes.bool,
+    collapsed: PropTypes.bool,
     setExpansion: PropTypes.func,
     media: PropTypes.element,
     mediaIcon: PropTypes.string,
@@ -64,7 +65,7 @@ export default class StatusContent extends React.PureComponent {
   }
 
   onLinkClick = (e) => {
-    if (this.props.expanded === false) {
+    if (this.props.collapsed) {
       if (this.props.parseClick) this.props.parseClick(e);
     }
   }
@@ -112,7 +113,7 @@ export default class StatusContent extends React.PureComponent {
     e.preventDefault();
 
     if (this.props.setExpansion) {
-      this.props.setExpansion(this.props.expanded ? null : true);
+      this.props.setExpansion(!this.props.expanded);
     } else {
       this.setState({ hidden: !this.state.hidden });
     }