From 85b7d570e6d282409884ba4069386d758fb6608d Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 4 Dec 2020 12:35:21 +0100 Subject: [PATCH] fix privacy lookup stage filtering --- src/preview/HomeServer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/preview/HomeServer.js b/src/preview/HomeServer.js index 5080e3b..7736e8c 100644 --- a/src/preview/HomeServer.js +++ b/src/preview/HomeServer.js @@ -81,8 +81,8 @@ export class HomeServer { const options = {method: "POST", body: "{}", headers}; const {status, body} = await this._request(`${this.baseURL}/_matrix/client/r0/register`, options).response(); if (status === 401 && body) { // Unauthorized - const stages = body.flows?.stages; - if (Array.isArray(stages) && stages.includes("m.login.terms")) { + const hasTermsStage = body.flows.some(flow => flow.stages.includes("m.login.terms")); + if (hasTermsStage) { const privacyPolicy = body.params?.["m.login.terms"]?.policies?.privacy_policy; if (privacyPolicy) { const firstLang = Object.keys(privacyPolicy).find(k => k !== "version");