aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-01-31 16:48:23 -0800
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-01-31 16:48:23 -0800
commit15a241e039d5b8481e349c709ee01435c09d8a2c (patch)
treeeb9eb0440eef8e8a8b1d4ccf3119c8e00de3b1d6
parent9278a8346d290c1b769758735380e2c1936c00be (diff)
downloadpatchfoo-15a241e039d5b8481e349c709ee01435c09d8a2c.tar.gz
patchfoo-15a241e039d5b8481e349c709ee01435c09d8a2c.zip
Add missing sigil
-rw-r--r--lib/app.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/app.js b/lib/app.js
index 7645cd1..d89eaa9 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -4,6 +4,7 @@ var lru = require('lrucache')
var pkg = require('../package')
var u = require('./util')
var pull = require('pull-stream')
+var ssbAvatar = require('ssb-avatar')
var Serve = require('./serve')
var Render = require('./render')
@@ -28,7 +29,7 @@ function App(sbot, config) {
sbot.get = memo({cache: lru(100)}, sbot.get)
this.getMsg = memo({cache: lru(100)}, getMsgWithValue, sbot)
- this.getAbout = memo({cache: lru(100)}, require('ssb-avatar'), sbot, sbot.id)
+ this.getAbout = memo({cache: lru(100)}, getAbout, sbot, sbot.id)
this.unboxContent = memo({cache: lru(100)}, sbot.private.unbox)
this.unboxMsg = this.unboxMsg.bind(this)
@@ -97,3 +98,14 @@ function getMsgWithValue(sbot, id, cb) {
cb(null, {key: id, value: value})
})
}
+
+function getAbout(sbot, src, id, cb) {
+ ssbAvatar(sbot, src, id, function (err, about) {
+ if (err) return cb(err)
+ var sigil = id && id[0] || '@'
+ if (about.name && about.name[0] !== sigil) {
+ about.name = sigil + about.name
+ }
+ cb(null, about)
+ })
+}