From e2e85a65e4096a2373a47c7a673c27c41ded98a2 Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 22 Jan 2024 22:11:42 +0200 Subject: [PATCH] fix doubled domain in brackets for emailDisplay="domain" --- api/js/etemplate/Et2Url/Et2UrlEmailReadonly.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/Et2Url/Et2UrlEmailReadonly.ts b/api/js/etemplate/Et2Url/Et2UrlEmailReadonly.ts index cda3a1bc4e..21c33add39 100644 --- a/api/js/etemplate/Et2Url/Et2UrlEmailReadonly.ts +++ b/api/js/etemplate/Et2Url/Et2UrlEmailReadonly.ts @@ -54,9 +54,18 @@ export class Et2UrlEmailReadonly extends Et2UrlReadonly { attrs.onclick = () => { - let email; - if (IsEmail.EMAIL_PREG.exec(email=this._value) || - IsEmail.EMAIL_PREG.exec(email = '"' + this._value + '" <' + this.statustext + '>')) + let email=this._value; + if (!IsEmail.EMAIL_PREG.exec(email)) + { + let name = this._value; + // do we need to remove the domain in brackets again? + if ((this.emailDisplay === 'preference' ? window.egw.preference("emailTag", "mail") : this.emailDisplay) === 'domain') + { + name = this._value.replace(/ \([^@. ]+\.[^@ )]+\)$/, ''); + } + email = '"' + name + '" <' + this.statustext + '>' + } + if (IsEmail.EMAIL_PREG.exec(email)) { Et2UrlEmail.action(email); }