Merge branch 'multiple-rules' into 'develop'

Account for multiple rules

See merge request soapbox-pub/soapbox-fe!1301
This commit is contained in:
Justin 2022-05-03 12:37:35 +00:00
commit 84907930cb
2 changed files with 9 additions and 3 deletions

View File

@ -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>
); );

View File

@ -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: