Updated profile redrawing

This commit is contained in:
Thomas Mathews 2023-01-06 19:11:34 -08:00
parent 608ac1ed04
commit 800d67651b
3 changed files with 5 additions and 23 deletions

View file

@ -170,7 +170,7 @@ function render_reaction_group(model, emoji, reactions, reacting_to) {
if (count > 5)
continue;
const pubkey = reactions[k].pubkey;
str += render_pfp(pubkey, model_get_profile(model, pubkey).data,
str += render_profile_img(model_get_profile(model, pubkey),
{noclick:true});
}
if (count > 5)
@ -287,16 +287,3 @@ function render_profile_img(profile, noclick=false) {
src="${get_profile_pic(profile)}"/>`
}
function render_pfp(pk, profile, opts={}) {
const name = fmt_profile_name(profile, fmt_pubkey(pk));
let str = html`class="pfp clickable" onclick="open_profile('${pk}')"`;
if (opts.noclick)
str = "class='pfp'";
return html`<img
$${str}
data-pubkey="${pk}"
title="${name}"
onerror="this.onerror=null;this.src='${IMG_NO_USER}';"
src="${get_picture(pk, profile)}"/>`
}

View file

@ -319,8 +319,10 @@ function view_timeline_update_profiles(model, pubkey) {
const name = fmt_name(p);
const pic = get_profile_pic(p);
for (const evid in model.elements) {
if (!event_contains_pubkey(model.all_events[evid], pubkey))
continue;
// Omitting this because we want to update profiles and names on all
// reactions
//if (!event_contains_pubkey(model.all_events[evid], pubkey))
// continue;
update_el_profile(model.elements[evid], pubkey, name, pic);
}
// Update the profile view if it's active

View file

@ -126,13 +126,6 @@ function reply_all(evid) {
reply(evid, true);
}
/*function redraw_my_pfp(model) {
const p = model_get_profile(model, model.pubkey).data;
const html = render_pfp(model.pubkey, p || {});
const el = document.querySelector(".my-userpic");
el.innerHTML = html;
}*/
function update_favicon(path) {
let link = document.querySelector("link[rel~='icon']");
const head = document.getElementsByTagName('head')[0]