Files: c115a76269ff7b6be741fd07738c2364a4bcea1d / modules / page / html / render / private.js
945 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 | }) |
10 | |
11 | exports.gives = nest('page.html.render') |
12 | |
13 | exports.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, windowSize: 50 }) |
32 | }) |
33 | } |
34 |
Built with git-ssb-web