git ssb

1+

punkmonk.termux / mvd



forked from ev / mvd

Commit d1280ce87c223562dd96000ce9762710008b8b88

implement basic friendstream

Ev Bogue committed on 1/17/2019, 9:08:08 PM
Parent: 5cffb63fdf14eb3f8d854d5bbc37d5282796f402

Files changed

views.jschanged
views.jsView
@@ -473,8 +473,44 @@
473473
474474 screen.appendChild(hyperscroll(content))
475475 }
476476
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+
477513 function everythingStream () {
478514
479515 var screen = document.getElementById('screen')
480516 var content = h('div.content')
@@ -514,10 +550,16 @@
514550 query: [{$filter: { value: { timestamp: { $gt: 0 }}}}]
515551 }),
516552 stream.top(content)
517553 )
554+
555+
556+
518557 }
519558
559+
560+
561+
520562 function backchannel () {
521563
522564 var screen = document.getElementById('screen')
523565 var content = h('div.content')
@@ -614,8 +656,10 @@
614656 } else if (ref.isMsg(src)) {
615657 msgThread(src)
616658 } else if (ref.isFeed(src.substring(5))) {
617659 mentionsStream(src.substring(5))
660+ } else if (ref.isFeed(src.substring(8))) {
661+ friendsStream(src.substring(8))
618662 } else if (src == 'queue') {
619663 queueStream()
620664 } else if (src == 'about') {
621665 about()

Built with git-ssb-web