fix ask every time not being respected for no preview option
This commit is contained in:
parent
9712ecf974
commit
9395d7f3f5
@ -19,13 +19,13 @@ import {ClientListView} from "./ClientListView.js";
|
|||||||
import {PreviewView} from "../preview/PreviewView.js";
|
import {PreviewView} from "../preview/PreviewView.js";
|
||||||
|
|
||||||
export class ServerConsentView extends TemplateView {
|
export class ServerConsentView extends TemplateView {
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
const useAnotherServer = t.button({
|
const useAnotherServer = t.button({
|
||||||
className: "text",
|
className: "text",
|
||||||
onClick: () => vm.setShowServers()}, "use another server");
|
onClick: () => vm.setShowServers()}, "use another server");
|
||||||
const continueWithoutPreview = t.button({
|
const continueWithoutPreview = t.button({
|
||||||
className: "text",
|
className: "text",
|
||||||
onClick: () => vm.continueWithoutConsent()
|
onClick: () => vm.continueWithoutConsent(this._askEveryTimeChecked)
|
||||||
}, "continue without a preview");
|
}, "continue without a preview");
|
||||||
return t.div({className: "ServerConsentView"}, [
|
return t.div({className: "ServerConsentView"}, [
|
||||||
t.p([
|
t.p([
|
||||||
@ -48,7 +48,7 @@ export class ServerConsentView extends TemplateView {
|
|||||||
continueWithoutPreview,
|
continueWithoutPreview,
|
||||||
"."
|
"."
|
||||||
]),
|
]),
|
||||||
t.form({action: "#", onSubmit: evt => this._onSubmit(evt)}, [
|
t.form({action: "#", id: "serverConsentForm", onSubmit: evt => this._onSubmit(evt)}, [
|
||||||
t.mapView(vm => vm.showSelectServer, show => show ? new ServerOptions(vm) : null),
|
t.mapView(vm => vm.showSelectServer, show => show ? new ServerOptions(vm) : null),
|
||||||
t.div({className: "actions"}, [
|
t.div({className: "actions"}, [
|
||||||
t.label([t.input({type: "checkbox", name: "askEveryTime"}), "Ask every time"]),
|
t.label([t.input({type: "checkbox", name: "askEveryTime"}), "Ask every time"]),
|
||||||
@ -60,8 +60,13 @@ export class ServerConsentView extends TemplateView {
|
|||||||
|
|
||||||
_onSubmit(evt) {
|
_onSubmit(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
const {askEveryTime} = evt.target.elements;
|
this.value.continueWithSelection(this._askEveryTimeChecked);
|
||||||
this.value.continueWithSelection(askEveryTime.checked);
|
}
|
||||||
|
|
||||||
|
get _askEveryTimeChecked() {
|
||||||
|
const form = document.getElementById("serverConsentForm");
|
||||||
|
const {askEveryTime} = form.elements;
|
||||||
|
return askEveryTime.checked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ export class ServerConsentViewModel extends ViewModel {
|
|||||||
this.done();
|
this.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
continueWithoutConsent() {
|
continueWithoutConsent(askEveryTime) {
|
||||||
this.preferences.setHomeservers([]);
|
this.preferences.setHomeservers([], !askEveryTime);
|
||||||
this.done();
|
this.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user