From 346a720d273d3007f31b561762f39027c934f671 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 1 Feb 2023 14:06:54 -0700 Subject: [PATCH] Et2LAvatar: Update statustext (tooltip) with name based on lname & fname --- api/js/etemplate/Et2Avatar/Et2LAvatar.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/Et2Avatar/Et2LAvatar.ts b/api/js/etemplate/Et2Avatar/Et2LAvatar.ts index f9ce0e02f3..df34d34068 100644 --- a/api/js/etemplate/Et2Avatar/Et2LAvatar.ts +++ b/api/js/etemplate/Et2Avatar/Et2LAvatar.ts @@ -65,17 +65,30 @@ export class Et2LAvatar extends Et2Avatar { super.updated(changedProperties); - if (changedProperties.has("lname") || changedProperties.has("fname") || changedProperties.has("contact_id") || changedProperties.has("src")) { - if (!this.src || decodeURIComponent(this.src).match("lavatar=1") && (this.fname || this.lname) && this.contact_id) + if(changedProperties.has("lname") || changedProperties.has("fname") || changedProperties.has("contact_id") || changedProperties.has("src")) + { + if(!this.src || decodeURIComponent(this.src).match("lavatar=1") && (this.fname || this.lname) && this.contact_id) { let lavatar = Et2LAvatar.lavatar(this.fname, this.lname, this.contact_id); this.initials = lavatar.initials; this._baseNode.style.backgroundColor = lavatar.background; } - else if (this.src) + else if(this.src) { this.image = this.src; } + + if(this.lname || this.fname) + { + // Update tooltip - we don't have enough info for more than name but we can put it in the right order + let label = (this.egw().preference("account_display", "common") || "firstname").includes("first") || !this.lname || !this.fname ? + this.fname + " " + this.lname : + this.lname + ", " + this.fname; + if(label != this.statustext) + { + this.statustext = label.trim(); + } + } } }