Commit caf3a5f8775fcebb0f0d23acfa6071301fd2031f
Enable private messages in local lite client
cel committed on 11/15/2016, 7:53:10 PMParent: 615ba51a344df64e9c77f4a1acd2c6bfb85ff581
Files changed
modules_basic/private.js | changed |
modules_basic/private.js | ||
---|---|---|
@@ -9,8 +9,9 @@ | ||
9 | 9 … | var message_render = plugs.first(exports.message_render = []) |
10 | 10 … | var message_compose = plugs.first(exports.message_compose = []) |
11 | 11 … | var message_unbox = plugs.first(exports.message_unbox = []) |
12 | 12 … | var sbot_log = plugs.first(exports.sbot_log = []) |
13 … | +var sbot_whoami = plugs.first(exports.sbot_whoami = []) | |
13 | 14 … | var avatar_image_link = plugs.first(exports.avatar_image_link = []) |
14 | 15 … | |
15 | 16 … | function unbox () { |
16 | 17 … | return pull( |
@@ -24,15 +25,22 @@ | ||
24 | 25 … | ) |
25 | 26 … | } |
26 | 27 … | |
27 | 28 … | exports.screen_view = function (path) { |
29 … | + if(path !== '/private') return | |
28 | 30 … | |
29 | - if(path === '/private') { | |
30 | - if(process.title === 'browser') | |
31 | - return h('div', h('h4', 'Private messages are not supported in the lite client.')) | |
31 … | + var div = h('div.column.scroller', | |
32 … | + {style: {'overflow':'auto'}}) | |
32 | 33 … | |
34 … | + // if local id is different from sbot id, sbot won't have indexes of | |
35 … | + // private threads | |
36 … | + var id = require('../keys').id | |
37 … | + sbot_whoami(function (err, feed) { | |
38 … | + if (err) return console.error(err) | |
39 … | + if(id !== feed.id) | |
40 … | + return div.appendChild(h('h4', | |
41 … | + 'Private messages are not supported in the lite client.')) | |
33 | 42 … | |
34 | - var id = require('../keys').id | |
35 | 43 … | var compose = message_compose( |
36 | 44 … | {type: 'post', recps: [], private: true}, |
37 | 45 … | { |
38 | 46 … | prepublish: function (msg) { |
@@ -47,12 +55,9 @@ | ||
47 | 55 … | } |
48 | 56 … | ) |
49 | 57 … | |
50 | 58 … | var content = h('div.column.scroller__content') |
51 | - var div = h('div.column.scroller', | |
52 | - {style: {'overflow':'auto'}}, | |
53 | - h('div.scroller__wrapper', compose, content) | |
54 | - ) | |
59 … | + div.appendChild(h('div.scroller__wrapper', compose, content)) | |
55 | 60 … | |
56 | 61 … | pull( |
57 | 62 … | u.next(sbot_log, {old: false, limit: 100}), |
58 | 63 … | unbox(), |
@@ -65,11 +70,11 @@ | ||
65 | 70 … | Scroller(div, content, message_render, false, false, function (err) { |
66 | 71 … | if(err) throw err |
67 | 72 … | }) |
68 | 73 … | ) |
74 … | + }) | |
69 | 75 … | |
70 | - return div | |
71 | - } | |
76 … | + return div | |
72 | 77 … | } |
73 | 78 … | |
74 | 79 … | function map(ary, iter) { |
75 | 80 … | if(Array.isArray(ary)) return ary.map(iter) |
Built with git-ssb-web