diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-01-10 21:26:06 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-01-10 21:27:09 -1000 |
commit | 964cb82322e65c807382c6a84eba0a8e21c1c70f (patch) | |
tree | f76f794bc1f0249ecfffb601e4f52d8232fa9157 /lib | |
parent | f34f08104b9613ba5f0ac43eb229ae992116224a (diff) | |
download | patchfoo-964cb82322e65c807382c6a84eba0a8e21c1c70f.tar.gz patchfoo-964cb82322e65c807382c6a84eba0a8e21c1c70f.zip |
Don't show comment links when we don't have the context to generate one
Diffstat (limited to 'lib')
-rw-r--r-- | lib/serve.js | 16 |
1 files changed, 11 insertions, 5 deletions
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))) ]), |