git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit f5bcb588c61e3a7eeab8ac67114e83109756f277

filter likes from public feed (experimental)

fixes #591
Matt McKegg committed on 7/20/2017, 3:27:32 AM
Parent: 6bf1d61b158ce574e9cc6736605236ab1895c14f

Files changed

modules/page/html/render/public.jschanged
sbot/roots.jschanged
modules/page/html/render/public.jsView
@@ -1,7 +1,8 @@
11 var nest = require('depnest')
22 var extend = require('xtend')
33 var pull = require('pull-stream')
4+var normalizeChannel = require('../../../../lib/normalize-channel')
45 var { h, send, when, computed, map } = require('mutant')
56
67 exports.needs = nest({
78 sbot: {
@@ -67,12 +68,13 @@
6768 prepend,
6869 updateStream: api.sbot.pull.stream(sbot => sbot.patchwork.latest({ids: [id]})),
6970 bumpFilter: function (msg) {
7071 if (msg.value && msg.value.content && typeof msg.value.content === 'object') {
72+ var type = msg.value.content.type
73+ if (type === 'vote') return false
74+
7175 var author = msg.value.author
72-
73- // TODO: should normalize this channel
74- var channel = msg.value.content.channel
76+ var channel = normalizeChannel(msg.value.content.channel)
7577 var isSubscribed = channel ? subscribedChannels().has(channel) : false
7678 return isSubscribed || id === author || following().has(author)
7779 }
7880 },
sbot/roots.jsView
@@ -194,8 +194,9 @@
194194 ssb.patchwork.getSubscriptions((err, subscriptions) => {
195195 if (err) return cb(err)
196196 cb(null, function (ids, msg) {
197197 var type = msg.value.content.type
198+ if (type === 'vote') return false // filter out likes
198199 var matchesChannel = (type !== 'channel' && checkChannel(subscriptions, ids, msg.value.content.channel))
199200 return ids.includes(msg.value.author) || matchesChannel || checkFollowing(contacts, ids, msg.value.author)
200201 })
201202 })

Built with git-ssb-web