Linkify channels and cut down on vote text links

This commit is contained in:
Anders Rune Jensen
2017-04-21 20:57:08 +02:00
parent f473523ec9
commit 16d0981db7
+4 -4
View File
@@ -575,19 +575,19 @@ function formatDate(date) {
function render(opts, c) function render(opts, c)
{ {
if (c.type === 'post') { if (c.type === 'post') {
var channel = c.channel ? ' in #' + c.channel : '' var channel = c.channel ? ' in <a href="/channel/' + c.channel + '">#' + c.channel + '</a>' : ''
return channel + renderPost(opts, c) return channel + renderPost(opts, c)
} else if (c.type == 'vote' && c.vote.expression == 'Dig') { } else if (c.type == 'vote' && c.vote.expression == 'Dig') {
var channel = c.channel ? ' in #' + c.channel : '' var channel = c.channel ? ' in <a href="/channel/' + c.channel + '">#' + c.channel + '</a>' : ''
var linkedText = 'this' var linkedText = 'this'
if (typeof c.vote.linkedText != 'undefined') if (typeof c.vote.linkedText != 'undefined')
linkedText = c.vote.linkedText.substring(0, 100) linkedText = c.vote.linkedText.substring(0, 75)
return ' dug ' + '<a href="/' + c.vote.link + '">' + linkedText + '</a>' + channel return ' dug ' + '<a href="/' + c.vote.link + '">' + linkedText + '</a>' + channel
} }
else if (c.type == 'vote') { else if (c.type == 'vote') {
var linkedText = 'this' var linkedText = 'this'
if (typeof c.vote.linkedText != 'undefined') if (typeof c.vote.linkedText != 'undefined')
linkedText = c.vote.linkedText.substring(0, 100) linkedText = c.vote.linkedText.substring(0, 75)
return ' voted <a href="/' + c.vote.link + '">' + linkedText + '</a>' return ' voted <a href="/' + c.vote.link + '">' + linkedText + '</a>'
} }
else if (c.type == 'contact' && c.following) { else if (c.type == 'contact' && c.following) {