diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-03-28 15:40:34 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-04-22 19:18:15 +0200 |
commit | 2888f74c1219e53e0aca28263ea8289d17264c21 (patch) | |
tree | 214cb47a59e84125dbb363c911fd152a32af66f9 /app/javascript/flavours/glitch/features | |
parent | 259bc9840b061fa466b203035b2941efd5a8907f (diff) |
Refactor the infamous three-valued boolean into two booleans, trying to simplify the logic
Diffstat (limited to 'app/javascript/flavours/glitch/features')
-rw-r--r-- | app/javascript/flavours/glitch/features/status/components/detailed_status.js | 1 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/status/index.js | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/features/status/components/detailed_status.js b/app/javascript/flavours/glitch/features/status/components/detailed_status.js index 066499da8..dddfd36b0 100644 --- a/app/javascript/flavours/glitch/features/status/components/detailed_status.js +++ b/app/javascript/flavours/glitch/features/status/components/detailed_status.js @@ -114,6 +114,7 @@ export default class DetailedStatus extends ImmutablePureComponent { media={media} mediaIcon={mediaIcon} expanded={expanded} + collapsed={false} setExpansion={setExpansion} /> diff --git a/app/javascript/flavours/glitch/features/status/index.js b/app/javascript/flavours/glitch/features/status/index.js index 717f99d4a..a1783d94a 100644 --- a/app/javascript/flavours/glitch/features/status/index.js +++ b/app/javascript/flavours/glitch/features/status/index.js @@ -76,7 +76,7 @@ export default class Status extends ImmutablePureComponent { state = { fullscreen: false, - isExpanded: null, + isExpanded: false, }; componentWillMount () { @@ -96,7 +96,7 @@ export default class Status extends ImmutablePureComponent { handleExpandedToggle = () => { if (this.props.status.get('spoiler_text')) { - this.setExpansion(this.state.isExpanded ? null : true); + this.setExpansion(!this.state.isExpanded); } }; @@ -292,7 +292,7 @@ export default class Status extends ImmutablePureComponent { } setExpansion = value => { - this.setState({ isExpanded: value ? true : null }); + this.setState({ isExpanded: value }); } setRef = c => { |