respect privacy better. hides who is in a private thread, does not show private messages in user feed, also does not show like/vote as thread replies
This commit is contained in:
@@ -120,6 +120,9 @@ exports.init = function (sbot, config) {
|
||||
|
||||
pull(
|
||||
sbot.createUserStream({ id: feedId, reverse: true, limit: showAll ? -1 : (ext == 'rss' ? 25 : 10) }),
|
||||
pull.filter(function (data) {
|
||||
return 'object' === typeof data.value.content
|
||||
}),
|
||||
pull.collect(function (err, logs) {
|
||||
if (err) return respond(res, 500, err.stack || err)
|
||||
res.writeHead(200, {
|
||||
@@ -279,12 +282,7 @@ exports.init = function (sbot, config) {
|
||||
var format = formatMsgs(id, ext, opts)
|
||||
if (format === null) return respond(res, 415, 'Invalid format')
|
||||
|
||||
pull(
|
||||
sbot.links({dest: id, values: true }),
|
||||
includeRoot && prepend(getMsg, id),
|
||||
pull.unique('key'),
|
||||
pull.collect(function (err, links) {
|
||||
if (err) return respond(res, 500, err.stack || err)
|
||||
function render (links) {
|
||||
var etag = hash(sort.heads(links).concat(appHash, ext, qs))
|
||||
if (req.headers['if-none-match'] === etag) return respond(res, 304)
|
||||
res.writeHead(200, {
|
||||
@@ -299,8 +297,22 @@ exports.init = function (sbot, config) {
|
||||
if (err) console.error('[viewer]', err)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
getMsgWithValue(sbot, id, function (err, root) {
|
||||
if (err) return respond(res, 500, err.stack || err)
|
||||
if('string' === typeof root.value.content)
|
||||
return render([root])
|
||||
|
||||
pull(
|
||||
sbot.links({dest: id, values: true, rel: 'root' }),
|
||||
pull.unique('key'),
|
||||
pull.collect(function (err, links) {
|
||||
if (err) return respond(res, 500, err.stack || err)
|
||||
render(links)
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
function addFollowAbout(msg, cb) {
|
||||
@@ -432,20 +444,24 @@ function serveFile(req, res, file) {
|
||||
})
|
||||
}
|
||||
|
||||
function prepend(fn, arg) {
|
||||
return function (read) {
|
||||
return function (abort, cb) {
|
||||
if (fn && !abort) {
|
||||
var _fn = fn
|
||||
fn = null
|
||||
return _fn(arg, function (err, value) {
|
||||
if (err) return read(err, function (err) {
|
||||
cb(err || true)
|
||||
})
|
||||
cb(null, value)
|
||||
})
|
||||
}
|
||||
read(abort, cb)
|
||||
}
|
||||
}
|
||||
}
|
||||
//function prepend(fn, arg) {
|
||||
// return function (read) {
|
||||
// return function (abort, cb) {
|
||||
// if (fn && !abort) {
|
||||
// var _fn = fn
|
||||
// fn = null
|
||||
// return _fn(arg, function (err, value) {
|
||||
// if (err) return read(err, function (err) {
|
||||
// cb(err || true)
|
||||
// })
|
||||
// cb(null, value)
|
||||
// })
|
||||
// }
|
||||
// read(abort, cb)
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user