Flatten _get_new_state_after_events
Flatten _get_new_state_after_events

rejig the if statements to simplify the logic and reduce indentation

matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse