diff --git a/js/main.js b/js/main.js index e3eeb09..3fe5c57 100644 --- a/js/main.js +++ b/js/main.js @@ -16,6 +16,7 @@ const SID_HISTORY = "history"; const SID_NOTIFICATIONS = "notifications"; const SID_EXPLORE = "explore"; const SID_PROFILES = "profiles"; +const SID_THREAD = "thread"; // This is our main entry. // https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event @@ -181,6 +182,7 @@ async function on_pool_eose(relay, sub_id) { const sid = sub_id.slice(0, sub_id.indexOf(":")); switch (sid) { + case SID_THREAD: case SID_PROFILES: case SID_META: case SID_HISTORY: @@ -231,6 +233,16 @@ function fetch_profile(pubkey, pool, relay) { }], relay); } +function fetch_thread_history(evid, pool) { + const sid = `${SID_THREAD}:${evid}` + pool.subscribe(sid, [{ + kinds: STANDARD_KINDS, + limit: 1000, + "#e": [evid], + }]); + log_debug(`fetching thread ${sid}`); +} + function subscribe_explore(limit) { DAMUS.pool.subscribe(SID_EXPLORE, [{ kinds: STANDARD_KINDS, diff --git a/js/ui/state.js b/js/ui/state.js index 783ab84..79511ba 100644 --- a/js/ui/state.js +++ b/js/ui/state.js @@ -18,6 +18,9 @@ function view_timeline_apply_mode(model, mode, opts={}) { } else { unsubscribe_explore(); } + if (mode == VM_THREAD) { + fetch_thread_history(thread_id, model.pool); + } el.dataset.mode = mode; switch(mode) {