Merge pull request #226 from matrix-org/danilafe/policy-links

Hide links when opening policy, show policy when navigated after load
This commit is contained in:
Bruno Windels 2021-08-26 09:51:24 +02:00 committed by GitHub
commit 24f8987972
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,13 +50,22 @@ export class RootViewModel extends ViewModel {
this.emitChange();
}
_hideLinks() {
this.link = null;
this.openLinkViewModel = null;
this.createLinkViewModel = null;
}
updateHash(hash) {
if (hash.startsWith("#/policy/")) {
const server = hash.substr(9);
this._hideLinks();
this.loadServerPolicyViewModel = new LoadServerPolicyViewModel(this.childOptions({server}));
this.loadServerPolicyViewModel.load();
this.emitChange();
} else {
const oldLink = this.link;
this.loadServerPolicyViewModel = null;
this.link = Link.parse(hash);
this._updateChildVMs(oldLink);
}