Account for multiple rules
This commit is contained in:
parent
b66b68b37c
commit
e2f24cdd6b
|
@ -116,11 +116,11 @@ const ReasonStep = (_props: IReasonStep) => {
|
||||||
|
|
||||||
<input
|
<input
|
||||||
name='reason'
|
name='reason'
|
||||||
type='radio'
|
type='checkbox'
|
||||||
value={rule.id}
|
value={rule.id}
|
||||||
checked={isSelected}
|
checked={isSelected}
|
||||||
readOnly
|
readOnly
|
||||||
className='h-4 w-4 mt-0.5 cursor-pointer text-primary-600 border-gray-300 focus:ring-primary-500'
|
className='h-4 w-4 cursor-pointer text-primary-600 border-gray-300 rounded focus:ring-primary-500'
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|
|
@ -54,7 +54,13 @@ export default function reports(state = initialState, action) {
|
||||||
case REPORT_BLOCK_CHANGE:
|
case REPORT_BLOCK_CHANGE:
|
||||||
return state.setIn(['new', 'block'], action.block);
|
return state.setIn(['new', 'block'], action.block);
|
||||||
case REPORT_RULE_CHANGE:
|
case REPORT_RULE_CHANGE:
|
||||||
return state.setIn(['new', 'rule_ids'], ImmutableSet([action.rule_id]));
|
return state.updateIn(['new', 'rule_ids'], ImmutableSet(), (set) => {
|
||||||
|
if (set.includes(action.rule_id)) {
|
||||||
|
return set.remove(action.rule_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return set.add(action.rule_id);
|
||||||
|
});
|
||||||
case REPORT_SUBMIT_REQUEST:
|
case REPORT_SUBMIT_REQUEST:
|
||||||
return state.setIn(['new', 'isSubmitting'], true);
|
return state.setIn(['new', 'isSubmitting'], true);
|
||||||
case REPORT_SUBMIT_FAIL:
|
case REPORT_SUBMIT_FAIL:
|
||||||
|
|
Loading…
Reference in New Issue