mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-15 18:38:57 +01:00
Api: Fix avatar images were not loaded
This commit is contained in:
parent
23895c94be
commit
d994f3f92e
@ -61,7 +61,7 @@ export class Et2Avatar extends Et2Widget(SlotMixin(SlAvatar)) implements et2_IDe
|
|||||||
/**
|
/**
|
||||||
* Contact id should be either user account_id {account:number} or contact_id {contact:number or number}
|
* Contact id should be either user account_id {account:number} or contact_id {contact:number or number}
|
||||||
*/
|
*/
|
||||||
contactId:{type: String},
|
contactId: {type: String, noAccessor: true},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image
|
* Image
|
||||||
@ -175,34 +175,35 @@ export class Et2Avatar extends Et2Widget(SlotMixin(SlAvatar)) implements et2_IDe
|
|||||||
{
|
{
|
||||||
let params = {};
|
let params = {};
|
||||||
let id = 'contact_id';
|
let id = 'contact_id';
|
||||||
|
let parsedId = "";
|
||||||
|
|
||||||
if (!_contactId)
|
if (!_contactId)
|
||||||
{
|
{
|
||||||
_contactId = this.egw().user('account_id');
|
parsedId = this.egw().user('account_id');
|
||||||
}
|
}
|
||||||
else if(_contactId.substr(0, 8) === 'account:')
|
else if(_contactId.substr(0, 8) === 'account:')
|
||||||
{
|
{
|
||||||
id = 'account_id';
|
id = 'account_id';
|
||||||
_contactId = _contactId.substr(8);
|
parsedId = _contactId.substr(8);
|
||||||
}
|
}
|
||||||
else if(_contactId.substr(0, 6) === 'email:')
|
else if(_contactId.substr(0, 6) === 'email:')
|
||||||
{
|
{
|
||||||
id = 'email';
|
id = 'email';
|
||||||
const matches = Et2Avatar.RFC822EMAIL.exec(_contactId);
|
const matches = Et2Avatar.RFC822EMAIL.exec(_contactId);
|
||||||
_contactId = matches ? matches[1] : _contactId.substr(6);
|
parsedId = matches ? matches[1] : _contactId.substr(6);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id = 'contact_id';
|
id = 'contact_id';
|
||||||
_contactId = _contactId.replace('contact:', '');
|
parsedId = _contactId.replace('contact:', '');
|
||||||
}
|
}
|
||||||
let oldContactId = this._contactId;
|
let oldContactId = this._contactId;
|
||||||
this._contactId = _contactId;
|
this._contactId = _contactId;
|
||||||
// if our src (incl. cache-buster) already includes the correct id, use that one
|
// if our image (incl. cache-buster) already includes the correct id, use that one
|
||||||
if (!this.src || !this.src.match("(&|\\?)contact_id="+_contactId+"(&|\\$)"))
|
if(!this.image || !this.image.match("(&|\\?)contact_id=" + parsedId + "(&|\\$)"))
|
||||||
{
|
{
|
||||||
params[id] = _contactId;
|
params[id] = parsedId;
|
||||||
this.src = egw.link('/api/avatar.php',params);
|
this.image = egw.link('/api/avatar.php', params);
|
||||||
}
|
}
|
||||||
this.requestUpdate("contactId", oldContactId);
|
this.requestUpdate("contactId", oldContactId);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user