fix(sw, notification): Don't issue an event if there is no affect (#8979)
* test * ]v]
This commit is contained in:
		
							parent
							
								
									714c80bf3f
								
							
						
					
					
						commit
						ae92378689
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		|  | @ -12,13 +12,15 @@ export async function readNotification( | ||||||
| 	if (notificationIds.length === 0) return; | 	if (notificationIds.length === 0) return; | ||||||
| 
 | 
 | ||||||
| 	// Update documents
 | 	// Update documents
 | ||||||
| 	await Notifications.update({ | 	const result = await Notifications.update({ | ||||||
| 		id: In(notificationIds), | 		id: In(notificationIds), | ||||||
| 		isRead: false, | 		isRead: false, | ||||||
| 	}, { | 	}, { | ||||||
| 		isRead: true, | 		isRead: true, | ||||||
| 	}); | 	}); | ||||||
| 
 | 
 | ||||||
|  | 	if (result.affected === 0) return; | ||||||
|  | 
 | ||||||
| 	if (!await Users.getHasUnreadNotification(userId)) return postReadAllNotifications(userId); | 	if (!await Users.getHasUnreadNotification(userId)) return postReadAllNotifications(userId); | ||||||
| 	else return postReadNotifications(userId, notificationIds); | 	else return postReadNotifications(userId, notificationIds); | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue