From 5be65a525ddad3faa523ae6b6e17409f13f30676 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 9 Dec 2020 11:14:06 +0000 Subject: [PATCH] Improve identifiers and code readability --- src/components/views/dialogs/ServerPickerDialog.tsx | 13 +++++++++++-- src/components/views/elements/ServerPicker.tsx | 2 +- src/utils/AutoDiscoveryUtils.js | 8 ++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/components/views/dialogs/ServerPickerDialog.tsx b/src/components/views/dialogs/ServerPickerDialog.tsx index e8a5fdcd1c..65d53f0870 100644 --- a/src/components/views/dialogs/ServerPickerDialog.tsx +++ b/src/components/views/dialogs/ServerPickerDialog.tsx @@ -49,10 +49,19 @@ export default class ServerPickerDialog extends React.PureComponent; } - let serverName = serverConfig.static ? serverConfig.hsUrl : serverConfig.hsName; + let serverName = serverConfig.isNameResolvable ? serverConfig.hsName : serverConfig.hsUrl; if (serverConfig.hsNameIsDifferent) { serverName = {serverConfig.hsName} diff --git a/src/utils/AutoDiscoveryUtils.js b/src/utils/AutoDiscoveryUtils.js index 3831dc9656..18b6451d3e 100644 --- a/src/utils/AutoDiscoveryUtils.js +++ b/src/utils/AutoDiscoveryUtils.js @@ -35,7 +35,7 @@ export class ValidatedServerConfig { isDefault: boolean; // when the server config is based on static URLs the hsName is not resolvable and things may wish to use hsUrl - static: boolean; + isNameResolvable: boolean; warning: string; } @@ -182,11 +182,11 @@ export default class AutoDiscoveryUtils { * @param {string} serverName The domain name the AutoDiscovery result is for. * @param {*} discoveryResult The AutoDiscovery result. * @param {boolean} syntaxOnly If true, errors relating to liveliness of the servers will not be raised. - * @param {boolean} isStatic If true, then the discoveryResult was synthesised locally. + * @param {boolean} isSynthetic If true, then the discoveryResult was synthesised locally. * @returns {Promise} Resolves to the validated configuration. */ static buildValidatedConfigFromDiscovery( - serverName: string, discoveryResult, syntaxOnly=false, isStatic=false): ValidatedServerConfig { + serverName: string, discoveryResult, syntaxOnly=false, isSynthetic=false): ValidatedServerConfig { if (!discoveryResult || !discoveryResult["m.homeserver"]) { // This shouldn't happen without major misconfiguration, so we'll log a bit of information // in the log so we can find this bit of codee but otherwise tell teh user "it broke". @@ -254,7 +254,7 @@ export default class AutoDiscoveryUtils { isUrl: preferredIdentityUrl, isDefault: false, warning: hsResult.error, - static: isStatic, + isNameResolvable: !isSynthetic, }); } }