Fix ssb-mentions adding null mentions

See: https://github.com/ssbc/ssb-mentions/issues/14
This commit is contained in:
Christian Bundy
2019-11-29 12:50:47 -08:00
parent 03a894b133
commit 37c356ccb8
3 changed files with 9 additions and 3 deletions

View File

@ -6,7 +6,9 @@ const meta = require('./models/post')
module.exports = async function publishReplyAllPage ({ message, text }) {
// TODO: rename `message` to `parent` or `ancestor` or similar
const mentions = ssbMentions(text) || undefined
const mentions = ssbMentions(text).filter((mention) =>
mention != null
) || undefined
const parent = await meta.get(message)
return post.replyAll({

View File

@ -5,7 +5,9 @@ const post = require('./models/post')
module.exports = async function publishReplyPage ({ message, text }) {
// TODO: rename `message` to `parent` or `ancestor` or similar
const mentions = ssbMentions(text) || undefined
const mentions = ssbMentions(text).filter((mention) =>
mention != null
) || undefined
const parent = await post.get(message)
return post.reply({

View File

@ -4,7 +4,9 @@ const ssbMentions = require('ssb-mentions')
const post = require('./models/post')
module.exports = async function publishPage ({ text }) {
const mentions = ssbMentions(text) || undefined
const mentions = ssbMentions(text).filter((mention) =>
mention != null
) || undefined
return post.publish({
text,
mentions