Commit 375a86a96a5e996629eeda68996cbb4b8293ece0
message.async.name: get names of private messages too!
Matt McKegg committed on 6/27/2017, 6:27:22 AMParent: 34f57706b5a39059731e9ea08eacb28496a23f64
Files changed
message/async/name.js | changed |
message/async/name.js | ||
---|---|---|
@@ -4,8 +4,9 @@ | ||
4 | 4 … | |
5 | 5 … | exports.needs = nest({ |
6 | 6 … | 'sbot.async.get': 'first', |
7 | 7 … | 'sbot.pull.links': 'first', |
8 … | + 'message.sync.unbox': 'first', | |
8 | 9 … | 'about.obs.socialValue': 'first', |
9 | 10 … | 'keys.sync.id': 'first' |
10 | 11 … | }) |
11 | 12 … | exports.gives = nest('message.async.name') |
@@ -16,8 +17,12 @@ | ||
16 | 17 … | return nest('message.async.name', function (id, cb) { |
17 | 18 … | if (!ref.isLink(id)) throw new Error('an id must be specified') |
18 | 19 … | var fallbackName = id.substring(0, 10) + '...' |
19 | 20 … | api.sbot.async.get(id, function (err, value) { |
21 … | + if (value && typeof value.content === 'string') { | |
22 … | + value = api.message.sync.unbox(value) | |
23 … | + } | |
24 … | + | |
20 | 25 … | if (err && err.name === 'NotFoundError') { |
21 | 26 … | return cb(null, fallbackName + '...(missing)') |
22 | 27 … | } else if (value.content.type === 'post' && typeof value.content.text === 'string') { |
23 | 28 … | if (value.content.text.trim()) { |
Built with git-ssb-web