mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-15 12:15:20 +08:00
Set identicon in cache when loading remote avatar fails
This commit is contained in:
parent
8645b0ab1e
commit
a83c3aacf8
1 changed files with 4 additions and 3 deletions
|
@ -79,7 +79,7 @@
|
|||
(from.name?.split(/[^\p{L}]+/gu) || []).reduce((a, s) => a + (s[0] || ''), '')
|
||||
.slice(0,2)
|
||||
.toUpperCase(),
|
||||
setIdenticon = (msg, fn) => {
|
||||
setIdenticon = (msg, fn, cache) => {
|
||||
const from = email(msg);
|
||||
if (identicons.get(from)) {
|
||||
fn(identicons.get(from));
|
||||
|
@ -90,8 +90,9 @@
|
|||
fromChars(msg.from[0]),
|
||||
window.getComputedStyle(getEl('rl-app'), null).getPropertyValue('font-family')
|
||||
));
|
||||
identicons.set(email(msg), uri);
|
||||
fn(uri);
|
||||
identicons.set(email(msg), uri);
|
||||
cache && avatars.set(getAvatarUid(msg), uri);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -199,7 +200,7 @@
|
|||
fn = url=>{element.src = url};
|
||||
element.onerror = ()=>{
|
||||
element.onerror = null;
|
||||
setIdenticon(msg, fn);
|
||||
setIdenticon(msg, fn, 1);
|
||||
};
|
||||
if (url) {
|
||||
fn(url);
|
||||
|
|
Loading…
Reference in a new issue