git ssb

10+

Matt McKegg / patchwork



Tree: 105aa7594db658635444cb37cc121c3952b8216b

Files: 105aa7594db658635444cb37cc121c3952b8216b / modules / page / html / render / private.js

929 bytesRaw
1var nest = require('depnest')
2var ref = require('ssb-ref')
3
4exports.needs = nest({
5 'feed.html.rollup': 'first',
6 'feed.pull.private': 'first',
7 'message.html.compose': 'first',
8 'keys.sync.id': 'first'
9})
10
11exports.gives = nest('page.html.render')
12
13exports.create = function (api) {
14 return nest('page.html.render', function channel (path) {
15 if (path !== '/private') return
16
17 var id = api.keys.sync.id()
18 var prepend = [
19 api.message.html.compose({
20 meta: {type: 'post'},
21 prepublish: function (msg) {
22 msg.recps = [id].concat(msg.mentions).filter(function (e) {
23 return ref.isFeed(typeof e === 'string' ? e : e.link)
24 })
25 return msg
26 },
27 placeholder: `Write a private message \n\n\n\nThis can only be read by yourself and people you have @mentioned.`
28 })
29 ]
30
31 return api.feed.html.rollup(api.feed.pull.private, { prepend })
32 })
33}
34

Built with git-ssb-web