Fix thread view so it doesn't show references

This commit is contained in:
Christian Bundy 2019-06-25 15:02:45 -07:00
parent a5cf8b67ce
commit ecc309ce87
No known key found for this signature in database
GPG Key ID: EB541AAEF4366237
1 changed files with 17 additions and 3 deletions

View File

@ -12,7 +12,7 @@ module.exports = async function thread (ctx) {
private: true
})
const root = rawMsg.key // lodash.get(rawMsg, 'value.content.root', rawMsg.key)
const root = rawMsg.key
var filterQuery = {
$filter: {
@ -28,8 +28,22 @@ module.exports = async function thread (ctx) {
const rawMsgs = await new Promise((resolve, reject) =>
pull(
backlinkStream,
pull.filter(msg =>
lodash.get(msg, 'value.content.type') === 'post'
pull.filter(msg => {
const isPost = lodash.get(msg, 'value.content.type') === 'post'
if (isPost === false) {
return false
}
const root = lodash.get(msg, 'value.content.root')
const fork = lodash.get(msg, 'value.content.fork')
if (root !== rawMsg.key && fork !== rawMsg.key) {
// mention
return false
}
return true
}
),
pull.collect((err, msgs) => {
if (err) return reject(err)