git ssb

2+

ev / mvd



Commit 618a38ee2f287072c80c2cddc56eba4536ffe253

root links in reply messages, shorten repost excerpts

Ev Bogue committed on 4/28/2018, 12:47:18 AM
Parent: 89e22f38502bc71de5434584a05d0545407c2336

Files changed

render.jschanged
render.jsView
@@ -28,13 +28,20 @@
2828 h('span.timestamp', h('a', {href: '#' + msg.key}, human(new Date(msg.value.timestamp)))),
2929 )
3030 }
3131
32 +function messageLink (msglink) {
33 + var link = h('span', h('a', {href: '#' + msglink}, msglink.substring(0, 8) + '...'))
34 + return link
35 +}
36 +
3237 module.exports = function (msg) {
3338 var message = h('div.message')
34- message.appendChild(header(msg))
35-
3639 if (msg.value.content.type == 'post') {
40 + message.appendChild(header(msg))
41 + if (msg.value.content.root) {
42 + message.appendChild(h('span', 're: ', messageLink(msg.value.content.root)))
43 + }
3744 message.appendChild(h('div.message__body',
3845 {innerHTML: markdown.block(msg.value.content.text, {toUrl: function (url, image) {
3946 if(url[0] == '%' || url[0] == '@') return '#' + url
4047 if(!image) return url
@@ -44,32 +51,34 @@
4451 )
4552 )
4653 return message
4754 } else if (msg.value.content.type == 'vote') {
55 + message.appendChild(header(msg))
4856 var embed = msg.value.content.vote.link
4957
5058 var embedded = h('div.embedded')
5159 sbot.get(embed, function (err, msg) {
5260 if (err) {console.log('could not find message locally, try ooo?') }
5361 msg.value = msg
5462 msg.key = embed
5563 if (msg.value.content.text) {
56- message.appendChild(h('img.emoji', {src: config.emojiUrl + 'star.png'}))
64 + //message.appendChild(h('img.emoji', {src: config.emojiUrl + 'star.png'}))
5765 message.appendChild(embedded)
5866 embedded.appendChild(header(msg))
5967 embedded.appendChild(h('div.message__body',
60- {innerHTML: markdown.block(msg.value.content.text, {toUrl: function (url, image) {
68 + {innerHTML: markdown.block(msg.value.content.text.substring(0, 256) + '... ', {toUrl: function (url, image) {
6169 if(url[0] == '@') return '#' + url
6270 if(url[0] == '%') return '#' + url
6371 if(!image) return url
6472 if(url[0] !== '&') return url
6573 return config.blobsUrl + url
66- }})}
74 + }})}, messageLink(msg.key)
6775 ))
6876 }
6977 })
7078 return message
7179 } else {
72- message.appendChild(h('pre', rawJSON(msg.value.content)))
73- return message
80 + //message.appendChild(h('pre', rawJSON(msg.value.content)))
81 + //return message
82 + return
7483 }
7584 }

Built with git-ssb-web