profile: update profile images
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details

Textnotes often miss profile pictures of authors because they
are rendered when received even without knowing the pic yet.

Update profile pic of already rendered textnotes with the picture
of the first kind 0 event that has a valid picture, should now
render missing profile pics.
OFF0 2 years ago
parent d01a2b7f37
commit 4195d438d9
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -414,9 +414,13 @@ function setMetadata(evt, relay, content) {
timestamp: evt.created_at,
...content,
};
// use only the first profile pic (for now), different pics on each releay are not supported yet
if (!user.picture) {
user.picture = picture;
} // no support (yet) for other picture from same pubkey on different relays
// update profile images
feedContainer.querySelectorAll(`[data-pubkey=${user.pubkey.slice(0, 12)}]`)
.forEach(img => img.setAttribute('src', picture));
}
}
// if (tempContactList[relay]) {
// const updates = tempContactList[relay].filter(update => update.pubkey === evt.pubkey);
@ -470,6 +474,7 @@ function getMetadata(evt, relay) {
loading: 'lazy',
src: userImg,
title: `${userName} on ${host} ${userAbout}`,
data: {pubkey: user.pubkey.slice(0, 12)},
}) : elemCanvas(evt.pubkey);
const isReply = evt.tags.some(hasEventTag);
const replies = replyList.filter((reply) => reply.tags[0][1] === evt.id);

Loading…
Cancel
Save