git ssb

16+

cel / patchfoo



Commit b51c32ba41cb9ce7d89a1ef5f70889c750f1bee3

refactor: simpler + faster logic; show own posts

Stephen Whitmore committed on 12/28/2017, 7:48:23 PM
Parent: 1e03dfe9d2542e269e643f0d7e10d6502f971fae

Files changed

lib/serve.jschanged
lib/serve.jsView
@@ -358,32 +358,29 @@
358358 gt: Number(q.gt) || -Infinity,
359359 filter: q.filter,
360360 }
361361 var app = this.app
362 + var self = this
362363
363- pull(
364- this.app.createLogStream(opts),
365- pull.asyncMap(function (msg, cb) {
366- var myId = app.sbot.id
367- var author = msg.value && msg.value.author
368- app.follows.getFollows(myId, function (err, follows) {
369- if (err) return cb(err)
370- if (follows[author]) return cb(null, msg)
371- msg.REJECTED = true
372- return cb(null, msg)
364 + var myId = app.sbot.id
365 + app.follows.getFollows(myId, function (err, follows) {
366 + if (err) return cb(err)
367 +
368 + pull(
369 + self.app.createLogStream(opts),
370 + pull.filter(function (msg) {
371 + var author = msg.value && msg.value.author
372 + return follows[author] || author === myId
373 + }),
374 + self.renderThreadPaginated(opts, null, q),
375 + self.wrapMessages(),
376 + self.wrapPublic(),
377 + self.wrapPage('public'),
378 + self.respondSink(200, {
379 + 'Content-Type': ctype(ext)
373380 })
374- }),
375- pull.filter(function (msg) {
376- return !msg.REJECTED
377- }),
378- this.renderThreadPaginated(opts, null, q),
379- this.wrapMessages(),
380- this.wrapPublic(),
381- this.wrapPage('public'),
382- this.respondSink(200, {
383- 'Content-Type': ctype(ext)
384- })
385- )
381 + )
382 + })
386383 }
387384
388385 Serve.prototype.setCookie = function (key, value, options) {
389386 var header = key + '=' + value

Built with git-ssb-web