mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
Et2ButtonTimestamper: Fix error where some users could not be found
In instances with > 100 users, it's possible the current user was not on the client side. Now checking user() first, it should always be there.
This commit is contained in:
parent
e26bcee006
commit
7052803700
@ -66,12 +66,11 @@ export class Et2ButtonTimestamper extends Et2Button
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwritten to maintain an internal clicked attribute
|
* Stamp the date / user into the target widget
|
||||||
*
|
*
|
||||||
* @param _ev
|
* @param _ev
|
||||||
* @returns {Boolean}
|
|
||||||
*/
|
*/
|
||||||
stamp(event: MouseEvent): boolean
|
stamp(event : MouseEvent)
|
||||||
{
|
{
|
||||||
const now = new Date(new Date().toLocaleString('en-US', {
|
const now = new Date(new Date().toLocaleString('en-US', {
|
||||||
timeZone: this.timezone || this.egw().preference('tz')
|
timeZone: this.timezone || this.egw().preference('tz')
|
||||||
@ -81,12 +80,27 @@ export class Et2ButtonTimestamper extends Et2Button
|
|||||||
let text = date(format, now);
|
let text = date(format, now);
|
||||||
|
|
||||||
// Get properly formatted user name
|
// Get properly formatted user name
|
||||||
|
|
||||||
|
// Try from account first, it's faster
|
||||||
|
const fromAccount = this.egw().user("account_fullname") || "";
|
||||||
|
|
||||||
|
if(fromAccount != "")
|
||||||
|
{
|
||||||
|
this.setText(text + fromAccount + ': ');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
const user = '' + parseInt(this.egw().user('account_id'));
|
const user = '' + parseInt(this.egw().user('account_id'));
|
||||||
this.egw().accounts('accounts').then((accounts) =>
|
this.egw().accounts('accounts').then((accounts) =>
|
||||||
{
|
{
|
||||||
const account = accounts.filter((option : SelectOption) => option.value == user)[0];
|
const account = accounts.filter((option : SelectOption) => option.value == user)[0];
|
||||||
text += account.label + ': ';
|
this.setText(text + account.label + ': ');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected setText(text)
|
||||||
|
{
|
||||||
const widget = this._get_input(this.target);
|
const widget = this._get_input(this.target);
|
||||||
let input = widget.input ? widget.input : widget.getDOMNode();
|
let input = widget.input ? widget.input : widget.getDOMNode();
|
||||||
if(input.context)
|
if(input.context)
|
||||||
@ -162,7 +176,6 @@ export class Et2ButtonTimestamper extends Et2Button
|
|||||||
input.scrollTop = scrollPos;
|
input.scrollTop = scrollPos;
|
||||||
input.focus();
|
input.focus();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _get_input(target)
|
private _get_input(target)
|
||||||
|
Loading…
Reference in New Issue
Block a user