From 964cb82322e65c807382c6a84eba0a8e21c1c70f Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 10 Jan 2018 21:26:06 -1000 Subject: Don't show comment links when we don't have the context to generate one --- lib/serve.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/serve.js') diff --git a/lib/serve.js b/lib/serve.js index 13d3fc5..8f7d1de 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -2693,15 +2693,21 @@ Serve.prototype.wrapBinary = function (opts) { var lineNum = i++ var id = hash + '-' + lineNum var idEnc = encodeURIComponent(id) + var allowComment = self.query.commit && self.query.path return [ ph('tr', [ + ph('td', + allowComment ? ph('a', { + href: '?msg=' + encodeURIComponent(self.query.msg) + + '&commit=' + encodeURIComponent(self.query.commit) + + '&path=' + encodeURIComponent(self.query.path) + + '&comment=' + idEnc + + '#' + idEnc + }, '…') : '' + ), ph('td', ph('a', { name: id, - href: '?msg=' + encodeURIComponent(self.query.msg) - + '&commit=' + encodeURIComponent(self.query.commit) - + '&path=' + encodeURIComponent(self.query.path) - + '&comment=' + idEnc - + '#' + idEnc + href: '#' + idEnc }, String(lineNum))), ph('td', ph('pre', self.app.render.highlight(line, ext))) ]), -- cgit v1.2.3