git ssb

2+

ev / mvd



Commit 20801c099bcddfd2a9a838fe13f6c9f2ad18f406

pass opts to the correct messages when publishing

Ev Bogue committed on 5/28/2018, 12:16:31 AM
Parent: 21e50bd1e6add2b74e4a6f1b4020ee7cb2f5261d

Files changed

compose.jschanged
render.jschanged
compose.jsView
@@ -75,24 +75,16 @@
7575 h('button.btn', 'Preview', {
7676 onclick: function () {
7777 if (textarea.value) {
7878 var msg = {}
79 +
7980 msg.value = {
8081 "author": id,
81- "content": {
82- "type": opts.type
83- }
82 + "content": opts
8483 }
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 +
9385 msg.value.content.text = textarea.value
94-
86 + console.log(msg)
9587 if (opts.type == 'post')
9688 var header = tools.header(msg)
9789 if (opts.type == 'update')
9890 var header = tools.timestamp(msg, {edited: true})
render.jsView
@@ -13,13 +13,14 @@
1313 module.exports = function (msg) {
1414 console.log(msg)
1515 var message = h('div.message#' + msg.key.substring(0, 44))
1616 if (msg.value.content.type == 'post') {
17- var opts = {}
17 + var opts = {
18 + type: 'post',
19 + branch: msg.key
20 + }
1821 var fallback = {}
1922
20- opts.type = 'post'
21- opts.branch = msg.key
2223
2324 if (msg.value.content.root)
2425 opts.root = msg.value.content.root
2526 else
@@ -51,9 +52,10 @@
5152 var buttons = h('div.buttons')
5253 buttons.appendChild(h('button.btn', 'Reply', {
5354 onclick: function () {
5455 var r = message.childNodes.length - 1
55-
56 + delete opts.updated
57 + delete opts.original
5658 fallback.buttons = message.childNodes[r]
5759 var compose = h('div.message#re:' + msg.key.substring(0, 44), composer(opts, fallback))
5860 message.parentNode.insertBefore(compose, message.nextSibling)
5961 }

Built with git-ssb-web