From 71a8f922962b3c3b3bb3b6f9b919be0f2005f943 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Mon, 20 May 2019 12:00:40 +0200 Subject: [PATCH] Always check permission settings in localstorage. --- src/persmission-handler.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/persmission-handler.js b/src/persmission-handler.js index a141d744e2..6fd11e36f9 100644 --- a/src/persmission-handler.js +++ b/src/persmission-handler.js @@ -39,8 +39,12 @@ function notAllowWarning (from, to) { export class PermissionHandler { constructor () { + this.permissions = this._getFromLocal() + } + + _getFromLocal() { const permission = localStorage.getItem('plugins/permissions') - this.permissions = permission ? JSON.parse(permission) : {} + return permission ? JSON.parse(permission) : {} } persistPermissions () { @@ -101,6 +105,7 @@ export class PermissionHandler { * @returns {Promise} */ async askPermission (from, to) { + this.permissions = this._getFromLocal() if (!this.permissions[to.name]) this.permissions[to.name] = {} if (!this.permissions[to.name][from.name]) return this.openPermission(from, to)