Files: ec7545f42881ca25d5d62a67b797b7ca4104ad11 / message / sync / getParticipants.js
574 bytesRaw
1 | const nest = require('depnest') |
2 | const get = require('lodash/get') |
3 | |
4 | exports.gives = nest('message.sync.getParticipants') |
5 | |
6 | exports.needs = nest({ |
7 | 'keys.sync.id': 'first' |
8 | }) |
9 | |
10 | exports.create = function (api) { |
11 | return nest('message.sync.getParticipants', getParticipants) |
12 | |
13 | function getParticipants (msg) { |
14 | const myKey = api.keys.sync.id() |
15 | |
16 | var participants = get(msg, 'value.content.recps') |
17 | .map(r => typeof r === 'string' ? r : r.link) |
18 | .filter(r => r != myKey) |
19 | .sort() |
20 | |
21 | participants.key = participants.join(' ') |
22 | return participants |
23 | } |
24 | } |
25 |
Built with git-ssb-web