Use some/every instead of doing it manually

This commit is contained in:
David Baker 2018-09-06 15:50:41 +01:00
parent eced58701d
commit 32da44615e

View file

@ -43,20 +43,12 @@ export async function startAnyRegistrationFlow(options) {
// ones like email & msisdn which require the user to supply // ones like email & msisdn which require the user to supply
// the relevant details in advance. We err on the side of // the relevant details in advance. We err on the side of
// caution though. // caution though.
let hasIlagFlow = false; const hasIlagFlow = flows.some((flow) => {
for (const flow of flows) { return flow.stages.every((stage) => {
let flowSuitable = true; return ['m.login.dummy', 'm.login.recaptcha'].includes(stage);
for (const stage of flow.stages) { });
if (!['m.login.dummy', 'm.login.recaptcha'].includes(stage)) { });
flowSuitable = false;
break;
}
}
if (flowSuitable) {
hasIlagFlow = true;
break;
}
}
if (hasIlagFlow) { if (hasIlagFlow) {
dis.dispatch({ dis.dispatch({
action: 'view_set_mxid', action: 'view_set_mxid',