Fix profile picture initial state & no image.
This commit is contained in:
parent
2288afbba3
commit
153d69f33d
3 changed files with 4 additions and 6 deletions
|
@ -70,6 +70,7 @@ async function webapp_init() {
|
|||
// WARNING Order Matters!
|
||||
init_message_textareas();
|
||||
view_show_spinner(true);
|
||||
redraw_my_pfp(model);
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
update_title(model);
|
||||
});
|
||||
|
|
|
@ -288,7 +288,7 @@ function render_pfp(pk, profile, opts={}) {
|
|||
$${str}
|
||||
data-pubkey="${pk}"
|
||||
title="${name}"
|
||||
onerror="this.onerror=null;this.src='./icon/no-user.svg';"
|
||||
onerror="this.onerror=null;this.src='${IMG_NO_USER}';"
|
||||
src="${get_picture(pk, profile)}"/>`
|
||||
}
|
||||
|
||||
|
|
|
@ -204,13 +204,10 @@ function reply_to(evid) {
|
|||
replybox.focus()
|
||||
}
|
||||
|
||||
function redraw_my_pfp(model, force = false) {
|
||||
function redraw_my_pfp(model) {
|
||||
const p = model.profiles[model.pubkey]
|
||||
if (!p) return;
|
||||
const html = render_pfp(model.pubkey, p);
|
||||
const html = render_pfp(model.pubkey, p || {});
|
||||
const el = document.querySelector(".my-userpic");
|
||||
if (!force && el.dataset.loaded) return;
|
||||
el.dataset.loaded = true;
|
||||
el.innerHTML = html;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue