aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r--lib/render-msg.js32
1 files changed, 20 insertions, 12 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 2a0e7df..72b8015 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -25,11 +25,7 @@ RenderMsg.prototype.toUrl = function (href) {
}
RenderMsg.prototype.linkify = function (text) {
- var arr = text.split(u.ssbRefRegex)
- for (var i = 1; i < arr.length; i += 2) {
- arr[i] = h('a', {href: this.toUrl(arr[i])}, arr[i])
- }
- return arr
+ return this.render.linkify(text)
}
function token() {
@@ -149,6 +145,8 @@ RenderMsg.prototype.actions = function () {
this.msg.rel ? [this.msg.rel, ' '] : '',
this.opts.withGt && this.msg.timestamp ? [
h('a', {href: '?gt=' + this.msg.timestamp}, '↓'), ' '] : '',
+ this.c.type === 'gathering' ? [
+ h('a', {href: this.render.toUrl('/about/' + encodeURIComponent(this.msg.key))}, 'about'), ' '] : '',
h('a', {href: this.toUrl(this.msg.key) + '?raw'}, 'raw'), ' ',
this.voteFormInner('dig')
) : [
@@ -342,7 +340,7 @@ RenderMsg.prototype.link = function (link, cb) {
var ref = u.linkDest(link)
if (!ref) return cb(null, '')
self.getName(ref, function (err, name) {
- if (err) return cb(err)
+ if (err) name = truncate(ref, 10)
cb(null, h('a', {href: self.toUrl(ref)}, name))
})
}
@@ -480,14 +478,20 @@ RenderMsg.prototype.gitUpdate = function (cb) {
!isNaN(size) ? [self.render.formatSize(size), ' '] : '',
self.c.refs ? h('ul', Object.keys(self.c.refs).map(function (ref) {
var id = self.c.refs[ref]
- return h('li',
- ref.replace(/^refs\/(heads|tags)\//, ''), ': ',
- id ? h('code', id) : h('em', 'deleted'))
+ var type = /^refs\/tags/.test(ref) ? 'tag' : 'commit'
+ var path = id && ('/git/' + type + '/' + encodeURIComponent(id)
+ + '?msg=' + encodeURIComponent(self.msg.key))
+ return h('li',
+ ref.replace(/^refs\/(heads|tags)\//, ''), ': ',
+ id ? h('a', {href: self.render.toUrl(path)}, h('code', id))
+ : h('em', 'deleted'))
})) : '',
Array.isArray(self.c.commits) ?
h('ul', self.c.commits.map(function (commit) {
- return h('li',
- h('code', String(commit.sha1).substr(0, 8)), ' ',
+ var path = '/git/commit/' + encodeURIComponent(commit.sha1)
+ + '?msg=' + encodeURIComponent(self.msg.key)
+ return h('li', h('a', {href: self.render.toUrl(path)},
+ h('code', String(commit.sha1).substr(0, 8))), ' ',
self.linkify(String(commit.title)),
self.gitCommitBody(commit.body)
)
@@ -500,7 +504,11 @@ RenderMsg.prototype.gitUpdate = function (cb) {
h('code', String(tag.object).substr(0, 8)), ' ',
String(tag.tag)
)
- })) : ''
+ })) : '',
+ self.c.commits_more ? h('div',
+ '+ ' + self.c.commits_more + ' more commits') : '',
+ self.c.tags_more ? h('div',
+ '+ ' + self.c.tags_more + ' more tags') : ''
), cb)
})
}