From 940fdb8e2f0ee906a779f4d54dc47754634e519b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 16 Dec 2020 10:07:07 +0000 Subject: [PATCH 1/3] Better adhere to MSC process --- src/Login.ts | 2 -- src/components/views/elements/SSOButtons.tsx | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Login.ts b/src/Login.ts index 281906d8610..6493b244e02 100644 --- a/src/Login.ts +++ b/src/Login.ts @@ -41,8 +41,6 @@ export interface IIdentityProvider { export interface ISSOFlow { type: "m.login.sso" | "m.login.cas"; - // eslint-disable-next-line camelcase - identity_providers: IIdentityProvider[]; "org.matrix.msc2858.identity_providers": IIdentityProvider[]; // Unstable prefix for MSC2858 } diff --git a/src/components/views/elements/SSOButtons.tsx b/src/components/views/elements/SSOButtons.tsx index f819b48cf67..57dd31f9d67 100644 --- a/src/components/views/elements/SSOButtons.tsx +++ b/src/components/views/elements/SSOButtons.tsx @@ -79,7 +79,7 @@ interface IProps { } const SSOButtons: React.FC = ({matrixClient, flow, loginType, fragmentAfterLogin, primary}) => { - const providers = flow.identity_providers || flow["org.matrix.msc2858.identity_providers"] || []; + const providers = flow["org.matrix.msc2858.identity_providers"] || []; if (providers.length < 2) { return
Date: Wed, 16 Dec 2020 10:41:56 +0000 Subject: [PATCH 2/3] fix tests --- src/components/structures/auth/Registration.tsx | 3 +-- test/components/structures/auth/Login-test.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/structures/auth/Registration.tsx b/src/components/structures/auth/Registration.tsx index d1dfa5ea508..095f3d34331 100644 --- a/src/components/structures/auth/Registration.tsx +++ b/src/components/structures/auth/Registration.tsx @@ -462,8 +462,7 @@ export default class Registration extends React.Component { let ssoSection; if (this.state.ssoFlow) { let continueWithSection; - const providers = this.state.ssoFlow["org.matrix.msc2858.identity_providers"] - || this.state.ssoFlow["identity_providers"] || []; + const providers = this.state.ssoFlow["org.matrix.msc2858.identity_providers"] || []; // when there is only a single (or 0) providers we show a wide button with `Continue with X` text if (providers.length > 1) { // i18n: ssoButtons is a placeholder to help translators understand context diff --git a/test/components/structures/auth/Login-test.js b/test/components/structures/auth/Login-test.js index 0631e26cbda..99faeb4b676 100644 --- a/test/components/structures/auth/Login-test.js +++ b/test/components/structures/auth/Login-test.js @@ -133,7 +133,7 @@ describe('Login', function() { root.setState({ flows: [{ type: "m.login.sso", - identity_providers: [{ + "org.matrix.msc2858.identity_providers": [{ id: "a", name: "Provider 1", }, { From 2142a65a9b1f5757d4db168accfc23fc08de0b5e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 16 Dec 2020 10:46:39 +0000 Subject: [PATCH 3/3] delint --- test/components/structures/auth/Login-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/components/structures/auth/Login-test.js b/test/components/structures/auth/Login-test.js index 99faeb4b676..9b73137936e 100644 --- a/test/components/structures/auth/Login-test.js +++ b/test/components/structures/auth/Login-test.js @@ -132,7 +132,7 @@ describe('Login', function() { // Set non-empty flows & matrixClient to get past the loading spinner root.setState({ flows: [{ - type: "m.login.sso", + "type": "m.login.sso", "org.matrix.msc2858.identity_providers": [{ id: "a", name: "Provider 1",