[MM-44644] Update configured server URL from SiteURL if available (#2152)

This commit is contained in:
Devin Binnie
2022-06-14 12:30:24 -04:00
committed by GitHub
parent 3d353d021b
commit 537ed1dd0c
5 changed files with 40 additions and 4 deletions

View File

@@ -55,13 +55,23 @@ export function updateServerInfos(teams: TeamWithTabs[]) {
});
Promise.all(serverInfos).then((data: Array<RemoteInfo | string | undefined>) => {
const teams = Config.teams;
teams.forEach((team) => openExtraTabs(data, team));
teams.forEach((team) => {
updateServerURL(data, team);
openExtraTabs(data, team);
});
Config.set('teams', teams);
}).catch((reason: any) => {
log.error('Error getting server infos', reason);
});
}
function updateServerURL(data: Array<RemoteInfo | string | undefined>, team: TeamWithTabs) {
const remoteInfo = data.find((info) => info && typeof info !== 'string' && info.name === team.name) as RemoteInfo;
if (remoteInfo && remoteInfo.siteURL) {
team.url = remoteInfo.siteURL;
}
}
function openExtraTabs(data: Array<RemoteInfo | string | undefined>, team: TeamWithTabs) {
const remoteInfo = data.find((info) => info && typeof info !== 'string' && info.name === team.name) as RemoteInfo;
if (remoteInfo) {