git ssb

10+

Matt McKegg / patchwork



Tree: e5ad753b8414d998113f9305e0826f4cf1035fe4

Files: e5ad753b8414d998113f9305e0826f4cf1035fe4 / modules / page / html / render / private.js

950 bytesRaw
1var nest = require('depnest')
2var ref = require('ssb-ref')
3var appRoot = require('app-root-path')
4var i18n = require(appRoot + '/lib/i18n').i18n
5
6exports.needs = nest({
7 'feed.html.rollup': 'first',
8 'feed.pull.private': 'first',
9 'message.html.compose': 'first',
10 'keys.sync.id': 'first'
11})
12
13exports.gives = nest('page.html.render')
14
15exports.create = function (api) {
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