damus.io

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

commit 85eae887242157addcc4b325fa4c30e10958655f
parent efb931163d3e19f13fc6b1b02c9c160f8a5d517b
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 19 Nov 2022 12:32:35 -0800

web: per-view max depth

Diffstat:
Mweb/js/damus.js | 12++++++++++--
Mweb/js/ui/render.js | 2+-
2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/web/js/damus.js b/web/js/damus.js @@ -64,7 +64,10 @@ function init_home_model() { ...init_timeline('explore'), seen: new Set(), }, - notifications: init_timeline('notifications'), + notifications: { + ...init_timeline('notifications'), + max_depth: 1, + }, profile: init_timeline('profile'), thread: init_timeline('thread'), }, @@ -916,10 +919,15 @@ function get_thread_root_id(damus, id) return ev.refs && ev.refs.root } +function get_default_max_depth(damus, view) +{ + return view.max_depth || damus.max_depth +} + function get_thread_max_depth(damus, view, root_id) { if (!view.depths[root_id]) - return damus.max_depth + return get_default_max_depth(damus, view) return view.depths[root_id] } diff --git a/web/js/ui/render.js b/web/js/ui/render.js @@ -5,7 +5,7 @@ function render_timeline_event(damus, view, ev) { const root_id = get_thread_root_id(damus, ev.id) - const max_depth = root_id ? get_thread_max_depth(damus, view, root_id) : damus.max_depth + const max_depth = root_id ? get_thread_max_depth(damus, view, root_id) : get_default_max_depth(damus, view) if (ev.refs && ev.refs.root && view.expanded.has(ev.refs.root)) max_depth = null