diff --git a/src/snek/service/notification.py b/src/snek/service/notification.py index 65d348f..1e34bae 100644 --- a/src/snek/service/notification.py +++ b/src/snek/service/notification.py @@ -62,17 +62,18 @@ class NotificationService(BaseService): except Exception: raise Exception(f"Failed to create notification: {model.errors}.") - try: - await self.app.services.push.notify_user( - user_uid=channel_member["user_uid"], - payload={ - "title": f"New message in {channel_member['label']}", - "message": f"{user['nick']}: {channel_message['message']}", - "icon": "/image/snek192.png", - "url": f"/channel/{channel_message['channel_uid']}.html", - }, - ) - except Exception as e: - print(f"Failed to send push notification:", e) + if channel_member["user_uid"] != user["uid"]: + try: + await self.app.services.push.notify_user( + user_uid=channel_member["user_uid"], + payload={ + "title": f"New message in {channel_member['label']}", + "message": f"{user['nick']}: {channel_message['message']}", + "icon": "/image/snek192.png", + "url": f"/channel/{channel_message['channel_uid']}.html", + }, + ) + except Exception as e: + print(f"Failed to send push notification:", e) self.app.db.commit()