protect from null mentions

This commit is contained in:
keyan 2021-08-19 14:53:11 -05:00
parent c239d05e30
commit 099a578a1b

View File

@ -294,8 +294,8 @@ const createMentions = async (item, models) => {
} }
try { try {
const mentions = item.text.match(namePattern).map(m => m.slice(1)) const mentions = item.text.match(namePattern)?.map(m => m.slice(1))
if (mentions.length > 0) { if (mentions?.length > 0) {
const users = await models.user.findMany({ const users = await models.user.findMany({
where: { where: {
name: { in: mentions } name: { in: mentions }