diff options
Diffstat (limited to 'app/javascript/flavours/glitch/features/report/containers')
-rw-r--r-- | app/javascript/flavours/glitch/features/report/containers/status_check_box_container.js | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/app/javascript/flavours/glitch/features/report/containers/status_check_box_container.js b/app/javascript/flavours/glitch/features/report/containers/status_check_box_container.js index 9bfd41ffc..aa34b3efd 100644 --- a/app/javascript/flavours/glitch/features/report/containers/status_check_box_container.js +++ b/app/javascript/flavours/glitch/features/report/containers/status_check_box_container.js @@ -1,19 +1,15 @@ import { connect } from 'react-redux'; import StatusCheckBox from '../components/status_check_box'; -import { toggleStatusReport } from 'flavours/glitch/actions/reports'; -import { Set as ImmutableSet } from 'immutable'; +import { makeGetStatus } from 'flavours/glitch/selectors'; -const mapStateToProps = (state, { id }) => ({ - status: state.getIn(['statuses', id]), - checked: state.getIn(['reports', 'new', 'status_ids'], ImmutableSet()).includes(id), -}); +const makeMapStateToProps = () => { + const getStatus = makeGetStatus(); -const mapDispatchToProps = (dispatch, { id }) => ({ + const mapStateToProps = (state, { id }) => ({ + status: getStatus(state, { id }), + }); - onToggle (e) { - dispatch(toggleStatusReport(id, e.target.checked)); - }, + return mapStateToProps; +}; -}); - -export default connect(mapStateToProps, mapDispatchToProps)(StatusCheckBox); +export default connect(makeMapStateToProps)(StatusCheckBox); |