diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-04-08 18:29:52 -0700 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-04-08 20:15:45 -0700 |
commit | 57c80659bb02d029c077c0658b1353cfcbe41e30 (patch) | |
tree | 103409f2c38e72e2b7f23d08131db5f8fbfe0e0c /lib | |
parent | 59c63c6542172be5a2b93a236b2eff928e742d58 (diff) | |
download | patchfoo-57c80659bb02d029c077c0658b1353cfcbe41e30.tar.gz patchfoo-57c80659bb02d029c077c0658b1353cfcbe41e30.zip |
Improve message title compuation
Prefer About info for non-textual messages
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.js | 1 | ||||
-rw-r--r-- | lib/render-msg.js | 10 |
2 files changed, 5 insertions, 6 deletions
@@ -146,6 +146,7 @@ App.prototype.getReverseNameSync = function (name) { } function getMsgWithValue(sbot, id, cb) { + if (!id) return cb() sbot.get(id, function (err, value) { if (err) return cb(err) cb(null, {key: id, value: value}) diff --git a/lib/render-msg.js b/lib/render-msg.js index d2d2c9a..380d451 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -298,13 +298,11 @@ RenderMsg.prototype.title = function (cb) { if (self.c.type === 'post') cb(null, title(self.c.text)) else - cb(null, self.c.type + ':' + (self.c.title || title(self.c.text))) - } else if (self.c.type === 'git-repo') { - self.getAboutName(self.msg.key, cb) + cb(null, '%' + self.c.type + ': ' + (self.c.title || title(self.c.text))) } else { - self.getAboutName(self.msg.key, function (err, name) { + self.app.getAbout(self.msg.key, function (err, about) { if (err) return cb(err) - if (name) return cb(null, name) + if (about.name) return cb(null, about.name) self.message(false, function (err, el) { if (err) return cb(err) cb(null, '%' + title(h('div', el).textContent)) @@ -315,7 +313,7 @@ RenderMsg.prototype.title = function (cb) { RenderMsg.prototype.getAboutName = function (id, cb) { this.app.getAbout(id, function (err, about) { - cb(err, about && about.name) + cb(err, about && about.name || String(id).substr(1, 8) + '…') }) } |