protect from null mentions
This commit is contained in:
		
							parent
							
								
									c239d05e30
								
							
						
					
					
						commit
						099a578a1b
					
				@ -294,8 +294,8 @@ const createMentions = async (item, models) => {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  try {
 | 
			
		||||
    const mentions = item.text.match(namePattern).map(m => m.slice(1))
 | 
			
		||||
    if (mentions.length > 0) {
 | 
			
		||||
    const mentions = item.text.match(namePattern)?.map(m => m.slice(1))
 | 
			
		||||
    if (mentions?.length > 0) {
 | 
			
		||||
      const users = await models.user.findMany({
 | 
			
		||||
        where: {
 | 
			
		||||
          name: { in: mentions }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user