[MM-44644] Update configured server URL from SiteURL if available (#2152)
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user