Commit 5dbcb1c1354e72b9f9db0d8e8cef9b89cee1989f
Handle boolean value false for publicWebHosting
cel committed on 12/19/2017, 8:31:49 PMParent: ff87105bd1d53bd820af183f22245f91f965e9e2
Files changed
lib/about.js | changed |
render.js | changed |
lib/about.js | ||
---|---|---|
@@ -8,8 +8,12 @@ | ||
8 | 8 … | function linkDest(val) { |
9 | 9 … | return val ? asString(val) || asString(val.link) : null |
10 | 10 … | } |
11 | 11 … | |
12 … | +function defalsify(val) { | |
13 … | + return val === 'false' ? false : val | |
14 … | +} | |
15 … | + | |
12 | 16 … | module.exports = function (sbot, id, cb) { |
13 | 17 … | var aboutByFeed = {} |
14 | 18 … | pull( |
15 | 19 … | sbot.links({ |
@@ -24,9 +28,9 @@ | ||
24 | 28 … | var feedAbout = aboutByFeed[author] || (aboutByFeed[author] = {}) |
25 | 29 … | if (c.name) feedAbout.name = c.name.replace(/^@?/, '@') |
26 | 30 … | if (c.image) feedAbout.image = linkDest(c.image) |
27 | 31 … | if (c.description) feedAbout.description = c.description |
28 | - if (c.publicWebHosting && author == c.about) feedAbout.publicWebHosting = c.publicWebHosting | |
32 … | + if (c.publicWebHosting != null && author === c.about) feedAbout.publicWebHosting = defalsify(c.publicWebHosting) | |
29 | 33 … | }, function (err) { |
30 | 34 … | if (err) return cb(err) |
31 | 35 … | // Use whatever properties have the most counts. |
32 | 36 … | // Usually we would want to handle renames for dead feeds and such, |
render.js | ||
---|---|---|
@@ -113,9 +113,9 @@ | ||
113 | 113 … | 'Scuttlebutt')).outerHTML; |
114 | 114 … | } |
115 | 115 … | |
116 | 116 … | function renderAbout(opts, about, showAllHTML = "") { |
117 | - if (about.publicWebHosting == 'false') { | |
117 … | + if (about.publicWebHosting === false) { | |
118 | 118 … | return pull( |
119 | 119 … | pull.map(renderMsg.bind(this, opts, '')), |
120 | 120 … | wrap(toolTipTop() + '<main>', '</main>' + callToAction()) |
121 | 121 … | ); |
@@ -344,9 +344,9 @@ | ||
344 | 344 … | } |
345 | 345 … | |
346 | 346 … | function renderMsg(opts, id, msg) { |
347 | 347 … | if (opts.renderPrivate == false && typeof(msg.value.content) == 'string') return '' |
348 | - if (msg.author.publicWebHosting == 'false') return h('article', 'User has chosen not to be hosted publicly').outerHTML; | |
348 … | + if (msg.author.publicWebHosting === false) return h('article', 'User has chosen not to be hosted publicly').outerHTML; | |
349 | 349 … | var c = msg.value.content || {}; |
350 | 350 … | var name = encodeURIComponent(msg.key); |
351 | 351 … | return h('article#' + name, |
352 | 352 … | h('header', |
Built with git-ssb-web