Commit 20801c099bcddfd2a9a838fe13f6c9f2ad18f406
pass opts to the correct messages when publishing
Ev Bogue committed on 5/28/2018, 12:16:31 AMParent: 21e50bd1e6add2b74e4a6f1b4020ee7cb2f5261d
Files changed
compose.js | changed |
render.js | changed |
compose.js | ||
---|---|---|
@@ -75,24 +75,16 @@ | ||
75 | 75 | h('button.btn', 'Preview', { |
76 | 76 | onclick: function () { |
77 | 77 | if (textarea.value) { |
78 | 78 | var msg = {} |
79 | + | |
79 | 80 | msg.value = { |
80 | 81 | "author": id, |
81 | - "content": { | |
82 | - "type": opts.type | |
83 | - } | |
82 | + "content": opts | |
84 | 83 | } |
85 | - | |
86 | - if (opts.root) | |
87 | - msg.value.content.root = opts.root | |
88 | - if (opts.original) | |
89 | - msg.value.content.original = opts.original | |
90 | - if (opts.updated) | |
91 | - msg.value.content.updated = opts.updated | |
92 | - | |
84 | + | |
93 | 85 | msg.value.content.text = textarea.value |
94 | - | |
86 | + console.log(msg) | |
95 | 87 | if (opts.type == 'post') |
96 | 88 | var header = tools.header(msg) |
97 | 89 | if (opts.type == 'update') |
98 | 90 | var header = tools.timestamp(msg, {edited: true}) |
render.js | ||
---|---|---|
@@ -13,13 +13,14 @@ | ||
13 | 13 | module.exports = function (msg) { |
14 | 14 | console.log(msg) |
15 | 15 | var message = h('div.message#' + msg.key.substring(0, 44)) |
16 | 16 | if (msg.value.content.type == 'post') { |
17 | - var opts = {} | |
17 | + var opts = { | |
18 | + type: 'post', | |
19 | + branch: msg.key | |
20 | + } | |
18 | 21 | var fallback = {} |
19 | 22 | |
20 | - opts.type = 'post' | |
21 | - opts.branch = msg.key | |
22 | 23 | |
23 | 24 | if (msg.value.content.root) |
24 | 25 | opts.root = msg.value.content.root |
25 | 26 | else |
@@ -51,9 +52,10 @@ | ||
51 | 52 | var buttons = h('div.buttons') |
52 | 53 | buttons.appendChild(h('button.btn', 'Reply', { |
53 | 54 | onclick: function () { |
54 | 55 | var r = message.childNodes.length - 1 |
55 | - | |
56 | + delete opts.updated | |
57 | + delete opts.original | |
56 | 58 | fallback.buttons = message.childNodes[r] |
57 | 59 | var compose = h('div.message#re:' + msg.key.substring(0, 44), composer(opts, fallback)) |
58 | 60 | message.parentNode.insertBefore(compose, message.nextSibling) |
59 | 61 | } |
Built with git-ssb-web