Skip to content

Commit 917446a

Browse files
committed
HTTP avatar proper condition and style fixes
1 parent 9fd2718 commit 917446a

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/headless/plugins/vcard/parsers.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ export async function parseVCardResultStanza(iq) {
3232
image_type,
3333
image_hash: u.arrayBufferToHex(ab),
3434
});
35-
}
36-
else if (image_url) {
35+
} else if (image_url) {
3736
Object.assign(result, {
3837
image_url,
3938
});

src/headless/plugins/vcard/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ export function onOccupantAvatarChanged(occupant) {
4646
vcards.push(_converse.state.vcards.get(occupant.get('jid')));
4747
}
4848
vcards.push(_converse.state.vcards.get(occupant.get('from')));
49-
vcards.forEach((v) => (hash || url) && v && (v?.get('image_hash') !== hash || v?.get('image_url') !== url) && api.vcard.update(v, true));
49+
vcards.filter((v) => v).forEach((v) => {
50+
if (hash && v.get('image_hash') !== hash || url && v.get('image_url') !== url) {
51+
api.vcard.update(v, true);
52+
}
53+
});
5054
}
5155

5256
/**

src/shared/avatar/templates/avatar.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import { html, nothing } from 'lit';
77
function getImgHref(image, image_type) {
88
if (image.startsWith('https:') || image.startsWith('data:')) {
99
return image;
10-
}
11-
else {
10+
} else {
1211
return `data:${image_type};base64,${image}`;
1312
}
1413
};

0 commit comments

Comments
 (0)