diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-08-28 17:16:30 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2018-08-31 18:35:03 +0200 |
commit | c6942a528332e99b605efa95ffa1c710324d368c (patch) | |
tree | 857b96004ccae2b5a7005afe681604db82661680 /app/javascript/flavours/glitch/features/status | |
parent | 5c400a28422121df01fc5ae73bc201f3b9aa5288 (diff) |
Add option to not automatically unfold content warnings matching a regexp
Fixes #678
Diffstat (limited to 'app/javascript/flavours/glitch/features/status')
-rw-r--r-- | app/javascript/flavours/glitch/features/status/index.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/status/index.js b/app/javascript/flavours/glitch/features/status/index.js index 060f2f345..3d309976a 100644 --- a/app/javascript/flavours/glitch/features/status/index.js +++ b/app/javascript/flavours/glitch/features/status/index.js @@ -38,6 +38,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import { HotKeys } from 'react-hotkeys'; import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/util/initial_state'; import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from 'flavours/glitch/util/fullscreen'; +import { autoUnfoldCW } from 'flavours/glitch/util/content_warning'; const messages = defineMessages({ deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, @@ -82,7 +83,7 @@ export default class Status extends ImmutablePureComponent { state = { fullscreen: false, - isExpanded: this.props.settings.getIn(['content_warnings', 'auto_unfold']), + isExpanded: undefined, threadExpanded: undefined, }; @@ -95,9 +96,14 @@ export default class Status extends ImmutablePureComponent { } componentWillReceiveProps (nextProps) { + if (this.state.isExpanded === undefined) { + const isExpanded = autoUnfoldCW(nextProps.settings, nextProps.status); + if (isExpanded !== undefined) this.setState({ isExpanded: isExpanded }); + } if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { this._scrolledIntoView = false; this.props.dispatch(fetchStatus(nextProps.params.statusId)); + this.setState({ isExpanded: autoUnfoldCW(nextProps.settings, nextProps.status) }); } } |