git ssb

9+

cel / ssb-viewer



Commit 5dbcb1c1354e72b9f9db0d8e8cef9b89cee1989f

Handle boolean value false for publicWebHosting

cel committed on 12/19/2017, 8:31:49 PM
Parent: ff87105bd1d53bd820af183f22245f91f965e9e2

Files changed

lib/about.jschanged
render.jschanged
lib/about.jsView
@@ -8,8 +8,12 @@
88 function linkDest(val) {
99 return val ? asString(val) || asString(val.link) : null
1010 }
1111
12 +function defalsify(val) {
13 + return val === 'false' ? false : val
14 +}
15 +
1216 module.exports = function (sbot, id, cb) {
1317 var aboutByFeed = {}
1418 pull(
1519 sbot.links({
@@ -24,9 +28,9 @@
2428 var feedAbout = aboutByFeed[author] || (aboutByFeed[author] = {})
2529 if (c.name) feedAbout.name = c.name.replace(/^@?/, '@')
2630 if (c.image) feedAbout.image = linkDest(c.image)
2731 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)
2933 }, function (err) {
3034 if (err) return cb(err)
3135 // Use whatever properties have the most counts.
3236 // Usually we would want to handle renames for dead feeds and such,
render.jsView
@@ -113,9 +113,9 @@
113113 'Scuttlebutt')).outerHTML;
114114 }
115115
116116 function renderAbout(opts, about, showAllHTML = "") {
117- if (about.publicWebHosting == 'false') {
117 + if (about.publicWebHosting === false) {
118118 return pull(
119119 pull.map(renderMsg.bind(this, opts, '')),
120120 wrap(toolTipTop() + '<main>', '</main>' + callToAction())
121121 );
@@ -344,9 +344,9 @@
344344 }
345345
346346 function renderMsg(opts, id, msg) {
347347 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;
349349 var c = msg.value.content || {};
350350 var name = encodeURIComponent(msg.key);
351351 return h('article#' + name,
352352 h('header',

Built with git-ssb-web