also include preference homeservers in server dialog

This commit is contained in:
Bruno Windels 2020-12-07 18:24:10 +01:00
parent cc643257a9
commit 7782a9d197

View file

@ -20,6 +20,7 @@ import {ClientViewModel} from "./ClientViewModel.js";
import {PreviewViewModel} from "../preview/PreviewViewModel.js"; import {PreviewViewModel} from "../preview/PreviewViewModel.js";
import {ServerConsentViewModel} from "./ServerConsentViewModel.js"; import {ServerConsentViewModel} from "./ServerConsentViewModel.js";
import {getLabelForLinkKind} from "../Link.js"; import {getLabelForLinkKind} from "../Link.js";
import {orderedUnique} from "../utils/unique.js";
export class OpenLinkViewModel extends ViewModel { export class OpenLinkViewModel extends ViewModel {
constructor(options) { constructor(options) {
@ -39,8 +40,14 @@ export class OpenLinkViewModel extends ViewModel {
} }
_showServerConsent() { _showServerConsent() {
let servers = [];
if (this.preferences.homeservers) {
servers.push(...this.preferences.homeservers);
}
servers.push(...this._link.servers);
servers = orderedUnique(servers);
this.serverConsentViewModel = new ServerConsentViewModel(this.childOptions({ this.serverConsentViewModel = new ServerConsentViewModel(this.childOptions({
servers: this._link.servers, servers,
done: () => { done: () => {
this.serverConsentViewModel = null; this.serverConsentViewModel = null;
this._showLink(); this._showLink();