git ssb

2+

ev / mvd



Commit c450fd3132bffcad2dbcb1f63b0076832ca11b94

actual working mutable messages

Ev Bogue committed on 5/5/2018, 12:08:01 AM
Parent: 3425a0245dc9195ecfb09c5155bf769205dc82ae

Files changed

render.jschanged
render.jsView
@@ -2,8 +2,10 @@
22 var config = require('./config')()
33
44 var pull = require('pull-stream')
55
6 +var human = require('human-time')
7 +
68 var sbot = require('./scuttlebot')
79 var composer = require('./compose')
810
911 var tools = require('./tools')
@@ -23,12 +25,10 @@
2325 message.appendChild(tools.header(msg))
2426
2527 if (msg.value.content.root) {
2628 message.appendChild(h('span', 're: ', tools.messageLink(msg.value.content.root)))
27- opts.root = msg.value.content.root
28- } else { opts.root = msg.key }
29 + }
2930
30-
3131 message.appendChild(
3232 h('div.message__body', tools.markdown(msg.value.content.text))
3333 )
3434
@@ -38,10 +38,16 @@
3838 opts.messageText = msg.value.content.text
3939 pull(
4040 sbot.query({query: [{$filter: {value: {content: {type: 'update', updated: msg.key}}}}]}),
4141 pull.drain(function (update) {
42- var latest = h('div.message__body', tools.markdown(update.value.content.text))
43- message.replaceChild(latest, message.childNodes[2])
42 + var latest = h('div.message__body',
43 + tools.markdown(update.value.content.text),
44 + h('span.timestamp', 'Edited: ', h('a', {href: '#' + update.key}, human(new Date(update.value.timestamp))))
45 + )
46 + var num = message.childNodes.length
47 + var act = num - 2
48 + console.log(act)
49 + message.replaceChild(latest, message.childNodes[act])
4450 opts.messageText = update.value.content.text
4551 })
4652
4753 )
@@ -60,14 +66,23 @@
6066 } else {
6167 opts.type = 'post'
6268 opts.branch = msg.key
6369
70 + if (msg.value.content.root) {
71 + message.appendChild(h('span', 're: ', tools.messageLink(msg.value.content.root)))
72 + opts.root = msg.value.content.root
73 + } else { opts.root = msg.key }
74 +
75 +
6476 pull(
6577 sbot.query({query: [{$filter: {value: {content: {type: 'update', updated: msg.key}}}}]}),
6678 pull.drain(function (data) {
6779 console.log(data)
68- var latest = h('div.message__body', tools.markdown(data.value.content.text))
69- message.replaceChild(latest, message.childNodes[2])
80 + var latest = h('div.message__body', tools.markdown(data.value.content.text), h('span.timestamp', 'Edited: ' + human(new Date(data.value.timestamp))))
81 + var num = message.childNodes.length
82 + var act = num - 2
83 +
84 + message.replaceChild(latest, message.childNodes[act])
7085 })
7186
7287 )
7388
@@ -101,10 +116,10 @@
101116 }
102117 })
103118 return message
104119 } else {
105- message.appendChild(tools.header(msg))
106- message.appendChild(h('pre', tools.rawJSON(msg.value.content)))
107- return message
108- //return
120 + //message.appendChild(tools.header(msg))
121 + //message.appendChild(h('pre', tools.rawJSON(msg.value.content)))
122 + //return message
123 + return
109124 }
110125 }

Built with git-ssb-web