Files: e901f4d90b0fa34e6b3cfa86b0c8f5f223ba731d / message / sync / is-blocked.js
434 bytesRaw
1 | const nest = require('depnest') |
2 | |
3 | exports.gives = nest('message.sync.isBlocked') |
4 | |
5 | exports.needs = nest({ |
6 | 'contact.obs.blocking': 'first', |
7 | 'keys.sync.id': 'first' |
8 | }) |
9 | |
10 | exports.create = function (api) { |
11 | var cache = null |
12 | |
13 | return nest('message.sync.isBlocked', function isBlockedMessage (msg) { |
14 | if (!cache) { |
15 | cache = api.contact.obs.blocking(api.keys.sync.id()) |
16 | } |
17 | |
18 | return cache().includes(msg.value.author) |
19 | }) |
20 | } |
21 |
Built with git-ssb-web