Files: d95ae6e1a02431fa8661487edc645af596a31fbe / message / sync / isBlocked.js
476 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 _myBlocking |
12 | |
13 | return nest('message.sync.isBlocked', function isBlockedMessage (msg) { |
14 | if (!_myBlocking) { |
15 | const myKey = api.keys.sync.id() |
16 | _myBlocking = api.contact.obs.blocking(myKey) |
17 | } |
18 | |
19 | return _myBlocking.includes(msg.value.author) |
20 | }) |
21 | } |
22 | |
23 |
Built with git-ssb-web