From 800d67651bfacd2e01215ead3f4faf3b5724105d Mon Sep 17 00:00:00 2001 From: Thomas Mathews Date: Fri, 6 Jan 2023 19:11:34 -0800 Subject: [PATCH] Updated profile redrawing --- js/ui/render.js | 15 +-------------- js/ui/state.js | 6 ++++-- js/ui/util.js | 7 ------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/js/ui/render.js b/js/ui/render.js index 3d2f74f..2e73c58 100644 --- a/js/ui/render.js +++ b/js/ui/render.js @@ -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`` -} - diff --git a/js/ui/state.js b/js/ui/state.js index bc6b78d..ae9f908 100644 --- a/js/ui/state.js +++ b/js/ui/state.js @@ -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 diff --git a/js/ui/util.js b/js/ui/util.js index 27667c7..94c9bdc 100644 --- a/js/ui/util.js +++ b/js/ui/util.js @@ -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]