Added user check to not notify user sending message
This commit is contained in:
		
							parent
							
								
									fcc2d7b748
								
							
						
					
					
						commit
						94b9d2c63b
					
				| @ -62,17 +62,18 @@ class NotificationService(BaseService): | |||||||
|             except Exception: |             except Exception: | ||||||
|                 raise Exception(f"Failed to create notification: {model.errors}.") |                 raise Exception(f"Failed to create notification: {model.errors}.") | ||||||
| 
 | 
 | ||||||
|             try: |             if channel_member["user_uid"] != user["uid"]: | ||||||
|                 await self.app.services.push.notify_user( |                 try: | ||||||
|                     user_uid=channel_member["user_uid"], |                     await self.app.services.push.notify_user( | ||||||
|                     payload={ |                         user_uid=channel_member["user_uid"], | ||||||
|                         "title": f"New message in {channel_member['label']}", |                         payload={ | ||||||
|                         "message": f"{user['nick']}: {channel_message['message']}", |                             "title": f"New message in {channel_member['label']}", | ||||||
|                         "icon": "/image/snek192.png", |                             "message": f"{user['nick']}: {channel_message['message']}", | ||||||
|                         "url": f"/channel/{channel_message['channel_uid']}.html", |                             "icon": "/image/snek192.png", | ||||||
|                     }, |                             "url": f"/channel/{channel_message['channel_uid']}.html", | ||||||
|                 ) |                         }, | ||||||
|             except Exception as e: |                     ) | ||||||
|                 print(f"Failed to send push notification:", e) |                 except Exception as e: | ||||||
|  |                     print(f"Failed to send push notification:", e) | ||||||
| 
 | 
 | ||||||
|         self.app.db.commit() |         self.app.db.commit() | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 BordedDev
						BordedDev