damus.io

damus.io website
git clone git://jb55.com/damus.io
Log | Files | Refs | README

commit a6dcec4c1d13a472a0dd35037dff441b8d352a7a
parent 7fa2c99c9ec2903be8265ffe3eab0f5e2c90600a
Author: William Casarin <jb55@jb55.com>
Date:   Fri,  4 Nov 2022 17:08:31 -0700

web: hacky boost workaround

Diffstat:
Mwebv2/damus.js | 9+++++++--
Mwebv2/index.html | 2+-
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/webv2/damus.js b/webv2/damus.js @@ -688,6 +688,7 @@ function render_boost(model, ev, opts) { return render_unknown_event(ev) const profile = model.profiles[ev.pubkey] + opts.is_boost_event = true return ` <div class="boost"> <div class="boost-text">Reposted by ${render_name_plain(ev.pubkey, profile)}</div> @@ -696,12 +697,16 @@ function render_boost(model, ev, opts) { ` } +function shouldnt_render_event(model, ev, opts) { + return !opts.is_boost_event && !opts.is_composing && !model.expanded.has(ev.id) && model.rendered[ev.id] +} + function render_event(model, ev, opts={}) { if (ev.kind === 6) return render_boost(model, ev, opts) - - if (!opts.is_composing && !model.expanded.has(ev.id) && model.rendered[ev.id]) + if (shouldnt_render_event(model, ev, opts)) return "" + delete opts.is_boost_event model.rendered[ev.id] = true const profile = model.profiles[ev.pubkey] || DEFAULT_PROFILE const delta = time_delta(new Date().getTime(), ev.created_at*1000) diff --git a/webv2/index.html b/webv2/index.html @@ -41,7 +41,7 @@ <script src="noble-secp256k1.js?v=1"></script> <script src="bech32.js?v=1"></script> <script src="nostr.js?v=6"></script> - <script src="damus.js?v=49"></script> + <script src="damus.js?v=50"></script> <script> // I have to delay loading to wait for nos2x const relay = setTimeout(damus_web_init, 100)