Commit d1280ce87c223562dd96000ce9762710008b8b88
implement basic friendstream
Ev Bogue committed on 1/17/2019, 9:08:08 PMParent: 5cffb63fdf14eb3f8d854d5bbc37d5282796f402
Files changed
views.js | changed |
views.js | ||
---|---|---|
@@ -473,8 +473,44 @@ | ||
473 | 473 | |
474 | 474 | screen.appendChild(hyperscroll(content)) |
475 | 475 | } |
476 | 476 | |
477 | + | |
478 | +function friendsStream (src) { | |
479 | + | |
480 | + var screen = document.getElementById('screen') | |
481 | + var content = h('div.content') | |
482 | + | |
483 | + screen.appendChild(hyperscroll(content)) | |
484 | + | |
485 | + function createStream (opts) { | |
486 | + return pull( | |
487 | + Next(sbot.query, opts, ['value', 'timestamp']), | |
488 | + pull.map(function (msg) { | |
489 | + sbot.friends.get({source: src, dest: msg.value.author}, function (err, data) { | |
490 | + if (data === true) { | |
491 | + return content.appendChild(render(msg)) | |
492 | + console.log(msg) | |
493 | + } else { | |
494 | + return content.appendChild(h('div')) | |
495 | + } | |
496 | + }) | |
497 | + }) | |
498 | + ) | |
499 | + } | |
500 | + | |
501 | + pull( | |
502 | + createStream({ | |
503 | + limit: 1000, | |
504 | + reverse: true, | |
505 | + live: false, | |
506 | + query: [{$filter: { value: { timestamp: { $gt: 0 }}}}] | |
507 | + }), | |
508 | + stream.bottom(content) | |
509 | + ) | |
510 | + | |
511 | +} | |
512 | + | |
477 | 513 | function everythingStream () { |
478 | 514 | |
479 | 515 | var screen = document.getElementById('screen') |
480 | 516 | var content = h('div.content') |
@@ -514,10 +550,16 @@ | ||
514 | 550 | query: [{$filter: { value: { timestamp: { $gt: 0 }}}}] |
515 | 551 | }), |
516 | 552 | stream.top(content) |
517 | 553 | ) |
554 | + | |
555 | + | |
556 | + | |
518 | 557 | } |
519 | 558 | |
559 | + | |
560 | + | |
561 | + | |
520 | 562 | function backchannel () { |
521 | 563 | |
522 | 564 | var screen = document.getElementById('screen') |
523 | 565 | var content = h('div.content') |
@@ -614,8 +656,10 @@ | ||
614 | 656 | } else if (ref.isMsg(src)) { |
615 | 657 | msgThread(src) |
616 | 658 | } else if (ref.isFeed(src.substring(5))) { |
617 | 659 | mentionsStream(src.substring(5)) |
660 | + } else if (ref.isFeed(src.substring(8))) { | |
661 | + friendsStream(src.substring(8)) | |
618 | 662 | } else if (src == 'queue') { |
619 | 663 | queueStream() |
620 | 664 | } else if (src == 'about') { |
621 | 665 | about() |
Built with git-ssb-web