Added fetching thread history.
This commit is contained in:
parent
6430640ec7
commit
bba6f4b784
2 changed files with 15 additions and 0 deletions
12
js/main.js
12
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,
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue