Commit c686096f58604cf1e3d26154208a452943606d2f
Merge branch 'master' of ssb://%q5d5Du+9WkaSdjc8aJPZm+jMrqgo0tmfR+RcX5ZZ6H4=.sha256
Ev Bogue committed on 7/29/2016, 12:35:36 PMParent: 5099c93781d03cac5a31333095ab9ed77255ce1e
Parent: d810f808a677b78123f6e140fa495f20b7085861
Files changed
lib/about.js | changed |
package.json | changed |
lib/about.js | ||
---|---|---|
@@ -11,8 +11,12 @@ | ||
11 | 11 … | var cat = require('pull-cat') |
12 | 12 … | var asyncMemo = require('asyncmemo') |
13 | 13 … | var u = require('./util') |
14 | 14 … | |
15 … | +function getLink(obj) { | |
16 … | + return typeof obj === 'string' ? obj : obj ? obj.link : null | |
17 … | +} | |
18 … | + | |
15 | 19 … | module.exports = function (sbot, id) { |
16 | 20 … | var getAbout = asyncMemo(getAboutFull, sbot, id) |
17 | 21 … | |
18 | 22 … | getAbout.getName = function (id, cb) { |
@@ -70,9 +74,9 @@ | ||
70 | 74 … | var c = msg.value.content |
71 | 75 … | if (!info.name && c.name) |
72 | 76 … | info.name = c.name |
73 | 77 … | if (!info.image && c.image) |
74 | - info.image = c.image.link | |
78 … | + info.image = getLink(c.image) | |
75 | 79 … | }, function (err) { |
76 | 80 … | if (err && err !== true) return cb(err) |
77 | 81 … | if (!info.name) info.name = u.truncate(target, 20) |
78 | 82 … | cb(null, info) |
@@ -96,14 +100,14 @@ | ||
96 | 100 … | // TODO: give about from source (self) priority over about from owner |
97 | 101 … | if (c.name) |
98 | 102 … | info.name = c.name |
99 | 103 … | if (c.image) |
100 | - info.image = c.image.link | |
104 … | + info.image = getLink(c.image) | |
101 | 105 … | } else { |
102 | 106 … | if (c.name && !info.name) |
103 | 107 … | info.name = c.name |
104 | 108 … | if (c.image && !info.image) |
105 | - info.image = c.image.link | |
109 … | + info.image = getLink(c.image) | |
106 | 110 … | } |
107 | 111 … | }, function (err) { |
108 | 112 … | if (err) console.error('about', err) |
109 | 113 … | }) |
Built with git-ssb-web