Commit f5bcb588c61e3a7eeab8ac67114e83109756f277
filter likes from public feed (experimental)
fixes #591Matt McKegg committed on 7/20/2017, 3:27:32 AM
Parent: 6bf1d61b158ce574e9cc6736605236ab1895c14f
Files changed
modules/page/html/render/public.js | changed |
sbot/roots.js | changed |
modules/page/html/render/public.js | ||
---|---|---|
@@ -1,7 +1,8 @@ | ||
1 | 1 … | var nest = require('depnest') |
2 | 2 … | var extend = require('xtend') |
3 | 3 … | var pull = require('pull-stream') |
4 … | +var normalizeChannel = require('../../../../lib/normalize-channel') | |
4 | 5 … | var { h, send, when, computed, map } = require('mutant') |
5 | 6 … | |
6 | 7 … | exports.needs = nest({ |
7 | 8 … | sbot: { |
@@ -67,12 +68,13 @@ | ||
67 | 68 … | prepend, |
68 | 69 … | updateStream: api.sbot.pull.stream(sbot => sbot.patchwork.latest({ids: [id]})), |
69 | 70 … | bumpFilter: function (msg) { |
70 | 71 … | 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 … | + | |
71 | 75 … | 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) | |
75 | 77 … | var isSubscribed = channel ? subscribedChannels().has(channel) : false |
76 | 78 … | return isSubscribed || id === author || following().has(author) |
77 | 79 … | } |
78 | 80 … | }, |
sbot/roots.js | ||
---|---|---|
@@ -194,8 +194,9 @@ | ||
194 | 194 … | ssb.patchwork.getSubscriptions((err, subscriptions) => { |
195 | 195 … | if (err) return cb(err) |
196 | 196 … | cb(null, function (ids, msg) { |
197 | 197 … | var type = msg.value.content.type |
198 … | + if (type === 'vote') return false // filter out likes | |
198 | 199 … | var matchesChannel = (type !== 'channel' && checkChannel(subscriptions, ids, msg.value.content.channel)) |
199 | 200 … | return ids.includes(msg.value.author) || matchesChannel || checkFollowing(contacts, ids, msg.value.author) |
200 | 201 … | }) |
201 | 202 … | }) |
Built with git-ssb-web