git ssb

3+

ev / decent



Commit 5d055f341136089cb45b7c7feab86b90e8c04232

quick fix on render

Ev Bogue committed on 1/3/2019, 5:32:28 PM
Parent: 9760f8a6b7e9529e590e975950c9a305d896419f

Files changed

render.jschanged
render.jsView
@@ -32,32 +32,37 @@
3232 }
3333
3434 else if (msg.value.content.type == 'edit') {
3535 message.appendChild(tools.header(msg))
36- var current = msg.value.content.text
37- sbot.get(msg.value.content.updated, function (err, updated) {
38- if (updated) {
39- fragment = document.createDocumentFragment()
40- var previous = updated.content.text
41- var ready = diff.diffWords(previous, current)
42- ready.forEach(function (part) {
43- if (part.added === true) {
44- color = 'blue'
45- } else if (part.removed === true) {
46- color = 'gray'
47- } else {color = '#333'}
48- var span = h('span')
49- span.style.color = color
50- if (part.removed === true) {
51- span.appendChild(h('del', document.createTextNode(part.value)))
52- } else {
53- span.appendChild(document.createTextNode(part.value))
36 + if (msg.value.content.text) {
37 + var current = msg.value.content.text
38 + sbot.get(msg.value.content.updated, function (err, updated) {
39 + if (updated) {
40 + // quick fix, need to decrypt messages if they're private
41 + if (updated.content.text) {
42 + fragment = document.createDocumentFragment()
43 + var previous = updated.content.text
44 + var ready = diff.diffWords(previous, current)
45 + ready.forEach(function (part) {
46 + if (part.added === true) {
47 + color = 'blue'
48 + } else if (part.removed === true) {
49 + color = 'gray'
50 + } else {color = '#333'}
51 + var span = h('span')
52 + span.style.color = color
53 + if (part.removed === true) {
54 + span.appendChild(h('del', document.createTextNode(part.value)))
55 + } else {
56 + span.appendChild(document.createTextNode(part.value))
57 + }
58 + fragment.appendChild(span)
59 + })
60 + message.appendChild(h('code', fragment))
5461 }
55- fragment.appendChild(span)
56- })
57- message.appendChild(h('code', fragment))
58- }
59- })
62 + }
63 + })
64 + }
6065 return message
6166 }
6267
6368

Built with git-ssb-web