aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-05-28 21:01:29 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-05-28 21:01:29 -1000
commit0e9903642e2e2c9cfb6f89f80a0256fa6f53ef5c (patch)
tree30bfa6e7ede6c125eec3a51cbef4892208b1f622 /lib/render-msg.js
parentd8f6c6a19274cf53d9967d3597dd582ee7233ca3 (diff)
parentb66bcecec258b0a2631ec338501afa9409882fe8 (diff)
downloadpatchfoo-0e9903642e2e2c9cfb6f89f80a0256fa6f53ef5c.tar.gz
patchfoo-0e9903642e2e2c9cfb6f89f80a0256fa6f53ef5c.zip
Merge branch 'master' into votes
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)
})
}