Handle boolean value false for publicWebHosting

This commit is contained in:
cel
2017-12-19 10:31:49 -10:00
parent ff87105bd1
commit 5dbcb1c135
2 changed files with 7 additions and 3 deletions
+5 -1
View File
@@ -9,6 +9,10 @@ function linkDest(val) {
return val ? asString(val) || asString(val.link) : null return val ? asString(val) || asString(val.link) : null
} }
function defalsify(val) {
return val === 'false' ? false : val
}
module.exports = function (sbot, id, cb) { module.exports = function (sbot, id, cb) {
var aboutByFeed = {} var aboutByFeed = {}
pull( pull(
@@ -25,7 +29,7 @@ module.exports = function (sbot, id, cb) {
if (c.name) feedAbout.name = c.name.replace(/^@?/, '@') if (c.name) feedAbout.name = c.name.replace(/^@?/, '@')
if (c.image) feedAbout.image = linkDest(c.image) if (c.image) feedAbout.image = linkDest(c.image)
if (c.description) feedAbout.description = c.description if (c.description) feedAbout.description = c.description
if (c.publicWebHosting && author == c.about) feedAbout.publicWebHosting = c.publicWebHosting if (c.publicWebHosting != null && author === c.about) feedAbout.publicWebHosting = defalsify(c.publicWebHosting)
}, function (err) { }, function (err) {
if (err) return cb(err) if (err) return cb(err)
// Use whatever properties have the most counts. // Use whatever properties have the most counts.
+2 -2
View File
@@ -114,7 +114,7 @@ function toolTipTop() {
} }
function renderAbout(opts, about, showAllHTML = "") { function renderAbout(opts, about, showAllHTML = "") {
if (about.publicWebHosting == 'false') { if (about.publicWebHosting === false) {
return pull( return pull(
pull.map(renderMsg.bind(this, opts, '')), pull.map(renderMsg.bind(this, opts, '')),
wrap(toolTipTop() + '<main>', '</main>' + callToAction()) wrap(toolTipTop() + '<main>', '</main>' + callToAction())
@@ -345,7 +345,7 @@ function docWrite(str) {
function renderMsg(opts, id, msg) { function renderMsg(opts, id, msg) {
if (opts.renderPrivate == false && typeof(msg.value.content) == 'string') return '' if (opts.renderPrivate == false && typeof(msg.value.content) == 'string') return ''
if (msg.author.publicWebHosting == 'false') return h('article', 'User has chosen not to be hosted publicly').outerHTML; if (msg.author.publicWebHosting === false) return h('article', 'User has chosen not to be hosted publicly').outerHTML;
var c = msg.value.content || {}; var c = msg.value.content || {};
var name = encodeURIComponent(msg.key); var name = encodeURIComponent(msg.key);
return h('article#' + name, return h('article#' + name,