Updated profile redrawing
This commit is contained in:
parent
608ac1ed04
commit
800d67651b
3 changed files with 5 additions and 23 deletions
|
@ -170,7 +170,7 @@ function render_reaction_group(model, emoji, reactions, reacting_to) {
|
||||||
if (count > 5)
|
if (count > 5)
|
||||||
continue;
|
continue;
|
||||||
const pubkey = reactions[k].pubkey;
|
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});
|
{noclick:true});
|
||||||
}
|
}
|
||||||
if (count > 5)
|
if (count > 5)
|
||||||
|
@ -287,16 +287,3 @@ function render_profile_img(profile, noclick=false) {
|
||||||
src="${get_profile_pic(profile)}"/>`
|
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)}"/>`
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -319,8 +319,10 @@ function view_timeline_update_profiles(model, pubkey) {
|
||||||
const name = fmt_name(p);
|
const name = fmt_name(p);
|
||||||
const pic = get_profile_pic(p);
|
const pic = get_profile_pic(p);
|
||||||
for (const evid in model.elements) {
|
for (const evid in model.elements) {
|
||||||
if (!event_contains_pubkey(model.all_events[evid], pubkey))
|
// Omitting this because we want to update profiles and names on all
|
||||||
continue;
|
// reactions
|
||||||
|
//if (!event_contains_pubkey(model.all_events[evid], pubkey))
|
||||||
|
// continue;
|
||||||
update_el_profile(model.elements[evid], pubkey, name, pic);
|
update_el_profile(model.elements[evid], pubkey, name, pic);
|
||||||
}
|
}
|
||||||
// Update the profile view if it's active
|
// Update the profile view if it's active
|
||||||
|
|
|
@ -126,13 +126,6 @@ function reply_all(evid) {
|
||||||
reply(evid, true);
|
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) {
|
function update_favicon(path) {
|
||||||
let link = document.querySelector("link[rel~='icon']");
|
let link = document.querySelector("link[rel~='icon']");
|
||||||
const head = document.getElementsByTagName('head')[0]
|
const head = document.getElementsByTagName('head')[0]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue