From 6d035c114738828d5a2384996babc8309a1cd03d Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 8 Jun 2024 20:11:58 +0800 Subject: [PATCH] :fire: Remove ws connected does not push notify feature --- .idea/workspace.xml | 6 +++--- pkg/services/notifications.go | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index fa0d6ab..1eed85a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,7 +4,7 @@ - @@ -166,7 +165,8 @@ - true diff --git a/pkg/services/notifications.go b/pkg/services/notifications.go index 43c76b0..c9c65f6 100644 --- a/pkg/services/notifications.go +++ b/pkg/services/notifications.go @@ -58,19 +58,14 @@ func NewNotification(notification models.Notification) error { } func PushNotification(notification models.Notification) error { - frontendAvailable := false for conn := range wsConn[notification.RecipientID] { - frontendAvailable = true _ = conn.WriteMessage(1, models.UnifiedCommand{ Action: "notifications.new", Payload: notification, }.Marshal()) } - // Skip push notification when frontend notify is available - if frontendAvailable && !notification.IsForcePush { - return nil - } + // TODO Detect the push notification is turned off (still push when IsForcePush is on) var subscribers []models.NotificationSubscriber if err := database.C.Where(&models.NotificationSubscriber{