Files: 84f42d561913f861b364caecc35050feadc23744 / modules / page / html / render / private.js
925 bytesRaw
1 | var nest = require('depnest') |
2 | var ref = require('ssb-ref') |
3 | |
4 | exports.needs = nest({ |
5 | 'feed.html.rollup': 'first', |
6 | 'feed.pull.private': 'first', |
7 | 'message.html.compose': 'first', |
8 | 'keys.sync.id': 'first', |
9 | 'intl.sync.i18n': 'first', |
10 | }) |
11 | |
12 | exports.gives = nest('page.html.render') |
13 | |
14 | exports.create = function (api) { |
15 | const i18n = api.intl.sync.i18n |
16 | return nest('page.html.render', function channel (path) { |
17 | if (path !== '/private') return |
18 | |
19 | var id = api.keys.sync.id() |
20 | var prepend = [ |
21 | api.message.html.compose({ |
22 | meta: {type: 'post'}, |
23 | prepublish: function (msg) { |
24 | msg.recps = [id].concat(msg.mentions).filter(function (e) { |
25 | return ref.isFeed(typeof e === 'string' ? e : e.link) |
26 | }) |
27 | return msg |
28 | }, |
29 | placeholder: i18n('Write a private message') |
30 | }) |
31 | ] |
32 | |
33 | return api.feed.html.rollup(api.feed.pull.private, { prepend }) |
34 | }) |
35 | } |
36 |
Built with git-ssb-web