🔥 Remove ws connected does not push notify feature
This commit is contained in:
parent
5b06b2dccb
commit
6d035c1147
@ -4,7 +4,7 @@
|
|||||||
<option name="autoReloadType" value="ALL" />
|
<option name="autoReloadType" value="ALL" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix APNs pushes no sound">
|
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix APNs pushes no sound (again)">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/services/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/services/notifications.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/pkg/services/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/services/notifications.go" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
@ -141,7 +141,6 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value=":bug: Bug fixes on forgot add realm members for account" />
|
|
||||||
<MESSAGE value=":bug: Bug fix on missing id in realm" />
|
<MESSAGE value=":bug: Bug fix on missing id in realm" />
|
||||||
<MESSAGE value=":bug: Bug fixes on realm missing member on creation" />
|
<MESSAGE value=":bug: Bug fixes on realm missing member on creation" />
|
||||||
<MESSAGE value=":bug: Dumb man make dumb mistake again" />
|
<MESSAGE value=":bug: Dumb man make dumb mistake again" />
|
||||||
@ -166,7 +165,8 @@
|
|||||||
<MESSAGE value=":bug: Fix APNs non-production" />
|
<MESSAGE value=":bug: Fix APNs non-production" />
|
||||||
<MESSAGE value=":bug: Bug fixes on notification badges for APNs" />
|
<MESSAGE value=":bug: Bug fixes on notification badges for APNs" />
|
||||||
<MESSAGE value=":bug: Fix APNs pushes no sound" />
|
<MESSAGE value=":bug: Fix APNs pushes no sound" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix APNs pushes no sound" />
|
<MESSAGE value=":bug: Fix APNs pushes no sound (again)" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix APNs pushes no sound (again)" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VgoProject">
|
<component name="VgoProject">
|
||||||
<settings-migrated>true</settings-migrated>
|
<settings-migrated>true</settings-migrated>
|
||||||
|
@ -58,19 +58,14 @@ func NewNotification(notification models.Notification) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PushNotification(notification models.Notification) error {
|
func PushNotification(notification models.Notification) error {
|
||||||
frontendAvailable := false
|
|
||||||
for conn := range wsConn[notification.RecipientID] {
|
for conn := range wsConn[notification.RecipientID] {
|
||||||
frontendAvailable = true
|
|
||||||
_ = conn.WriteMessage(1, models.UnifiedCommand{
|
_ = conn.WriteMessage(1, models.UnifiedCommand{
|
||||||
Action: "notifications.new",
|
Action: "notifications.new",
|
||||||
Payload: notification,
|
Payload: notification,
|
||||||
}.Marshal())
|
}.Marshal())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip push notification when frontend notify is available
|
// TODO Detect the push notification is turned off (still push when IsForcePush is on)
|
||||||
if frontendAvailable && !notification.IsForcePush {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var subscribers []models.NotificationSubscriber
|
var subscribers []models.NotificationSubscriber
|
||||||
if err := database.C.Where(&models.NotificationSubscriber{
|
if err := database.C.Where(&models.NotificationSubscriber{
|
||||||
|
Loading…
Reference in New Issue
Block a user