Commit f5a00d5cf86de5f3363ef3c52de288cb24586390
Don't show posts of users you blocked
Anders Rune Jensen committed on 9/28/2017, 7:48:44 PMParent: bb1e475fdd46fa47fff6cd11fbcb7fa4c1157d43
Files changed
message/html/render/post.js | changed |
message/html/render/post.js | ||
---|---|---|
@@ -2,8 +2,10 @@ | ||
2 | 2 | var nest = require('depnest') |
3 | 3 | var extend = require('xtend') |
4 | 4 | |
5 | 5 | exports.needs = nest({ |
6 | + 'contact.obs.blockers': 'first', | |
7 | + 'keys.sync.id': 'first', | |
6 | 8 | 'message.html': { |
7 | 9 | decorate: 'reduce', |
8 | 10 | layout: 'first', |
9 | 11 | link: 'first', |
@@ -13,10 +15,16 @@ | ||
13 | 15 | |
14 | 16 | exports.gives = nest('message.html.render') |
15 | 17 | |
16 | 18 | exports.create = function (api) { |
19 | + const myId = api.keys.sync.id() | |
20 | + | |
17 | 21 | return nest('message.html.render', function renderMessage (msg, opts) { |
18 | 22 | if (msg.value.content.type !== 'post') return |
23 | + | |
24 | + const blockers = api.contact.obs.blockers(msg.value.author) | |
25 | + if (blockers().includes(myId)) return | |
26 | + | |
19 | 27 | var element = api.message.html.layout(msg, extend({ |
20 | 28 | title: messageTitle(msg), |
21 | 29 | content: messageContent(msg), |
22 | 30 | layout: 'default' |
Built with git-ssb-web