git ssb

7+

dinoworm 🐛 / patchcore



Commit 375a86a96a5e996629eeda68996cbb4b8293ece0

message.async.name: get names of private messages too!

Matt McKegg committed on 6/27/2017, 6:27:22 AM
Parent: 34f57706b5a39059731e9ea08eacb28496a23f64

Files changed

message/async/name.jschanged
message/async/name.jsView
@@ -4,8 +4,9 @@
44
55 exports.needs = nest({
66 'sbot.async.get': 'first',
77 'sbot.pull.links': 'first',
8 + 'message.sync.unbox': 'first',
89 'about.obs.socialValue': 'first',
910 'keys.sync.id': 'first'
1011 })
1112 exports.gives = nest('message.async.name')
@@ -16,8 +17,12 @@
1617 return nest('message.async.name', function (id, cb) {
1718 if (!ref.isLink(id)) throw new Error('an id must be specified')
1819 var fallbackName = id.substring(0, 10) + '...'
1920 api.sbot.async.get(id, function (err, value) {
21 + if (value && typeof value.content === 'string') {
22 + value = api.message.sync.unbox(value)
23 + }
24 +
2025 if (err && err.name === 'NotFoundError') {
2126 return cb(null, fallbackName + '...(missing)')
2227 } else if (value.content.type === 'post' && typeof value.content.text === 'string') {
2328 if (value.content.text.trim()) {

Built with git-ssb-web