Fix promise chaining when loading serviceuser details screen Sometimes generating a HTTP password could seem to be stuck. In such cases the request was never sent because the pluginRestApi object was null. This happened, because the relevant permission check was done too late due to improper promise chaining. Change-Id: I620525f520c62271cfc2009c477d8f2f07ade75a
diff --git a/web/gr-serviceuser-detail.ts b/web/gr-serviceuser-detail.ts index 10decf2..e2d4f94 100644 --- a/web/gr-serviceuser-detail.ts +++ b/web/gr-serviceuser-detail.ts
@@ -372,18 +372,18 @@ } private getPluginConfig() { - return Promise.resolve(this.getPermissions()).then(() => { - this.pluginRestApi - .get<ConfigInfo>('/config/server/serviceuser~config/') - .then(config => { - if (!config) { - return; - } - this.emailAllowed = config.allow_email || this.isAdmin; - this.ownerAllowed = config.allow_owner || this.isAdmin; - this.httpPasswordAllowed = config.allow_http_password || this.isAdmin; - }); - }); + return this.getPermissions() + .then(() => + this.pluginRestApi.get<ConfigInfo>('/config/server/serviceuser~config/') + ) + .then(config => { + if (!config) { + return; + } + this.emailAllowed = config.allow_email || this.isAdmin; + this.ownerAllowed = config.allow_owner || this.isAdmin; + this.httpPasswordAllowed = config.allow_http_password || this.isAdmin; + }); } private getServiceUser() {