mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
Api: Fix bug where multiple calls to egw.preference(...,...,true) only the first call would get the value, others would get undefined
This commit is contained in:
parent
823f98f49e
commit
7516e2d1b8
@ -100,10 +100,16 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function()
|
||||
if (_callback === false) return undefined;
|
||||
const request = this.json('EGroupware\\Api\\Framework::ajax_get_preference', [_app], _callback, _context);
|
||||
const promise = request.sendRequest(typeof _callback !== 'undefined', 'GET');
|
||||
if (typeof prefs[_app] === 'undefined') prefs[_app] = {};
|
||||
if (typeof prefs[_app] === 'undefined') prefs[_app] = promise;
|
||||
if (_callback === true) return promise.then(() => this.preference(_name, _app));
|
||||
if (typeof _callback === 'function') return false;
|
||||
}
|
||||
else if (typeof prefs[_app] === 'object' && typeof prefs[_app].then === 'function')
|
||||
{
|
||||
if (_callback === false) return undefined;
|
||||
if (_callback === true) return prefs[_app].then(() => this.preference(_name, _app));
|
||||
if (typeof _callback === 'function') return false;
|
||||
}
|
||||
let ret;
|
||||
if (_name === "*")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user