Account for multiple rules

This commit is contained in:
Justin 2022-05-03 08:13:26 -04:00
parent b66b68b37c
commit e2f24cdd6b
2 changed files with 9 additions and 3 deletions

View file

@ -116,11 +116,11 @@ const ReasonStep = (_props: IReasonStep) => {
<input
name='reason'
type='radio'
type='checkbox'
value={rule.id}
checked={isSelected}
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>
);

View file

@ -54,7 +54,13 @@ export default function reports(state = initialState, action) {
case REPORT_BLOCK_CHANGE:
return state.setIn(['new', 'block'], action.block);
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:
return state.setIn(['new', 'isSubmitting'], true);
case REPORT_SUBMIT_FAIL: