prefer source attribute (with cache-buster) over contact_id

add cache-buster, if we have just a contact_id
This commit is contained in:
Ralf Becker 2019-02-20 17:08:40 +01:00
parent f9dd120d32
commit 4532221717

View File

@ -365,6 +365,8 @@ var et2_avatar = (function(){ "use strict"; return et2_image.extend(
};
var id = 'contact_id';
this.image.addClass('et2_avatar');
if (!_contact_id)
{
_contact_id = this.egw().user('account_id');
@ -380,8 +382,15 @@ var et2_avatar = (function(){ "use strict"; return et2_image.extend(
_contact_id = _contact_id.replace('contact:', '');
}
// if our src (incl. cache-buster) already includes the correct id, use that one
if (this.options.src && this.options.src.match("(&|\\?)contact_id="+_contact_id+"(&|\\$)"))
{
return;
}
// we have only the id, so we need to bypass caching with a cache-buster
params[id] = _contact_id;
this.image.addClass('et2_avatar');
params._cache = (new Date).getTime();
var url = egw.link('/index.php',params);
this.set_src(url);