🐛 Fix notification push issue

This commit is contained in:
LittleSheep 2024-05-13 22:31:19 +08:00
parent 07dbdd80ec
commit 0e89e325d4
2 changed files with 5 additions and 6 deletions

View File

@ -4,8 +4,9 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Bug fixes on E2EE">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix key exchange cause echo">
<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" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -138,7 +139,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value=":sparkles: New ticket ways" />
<MESSAGE value=":sparkles: Sign up &amp; Sign in" />
<MESSAGE value=":sparkles: An entire complete sign in user flow" />
<MESSAGE value=":sparkles: User center page" />
@ -163,7 +163,8 @@
<MESSAGE value=":recycle: Improved the notification subscriber API" />
<MESSAGE value=":sparkles: E2EE Key Exchange" />
<MESSAGE value=":bug: Bug fixes on E2EE" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Bug fixes on E2EE" />
<MESSAGE value=":bug: Fix key exchange cause echo" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix key exchange cause echo" />
</component>
<component name="VgoProject">
<settings-migrated>true</settings-migrated>

View File

@ -2,7 +2,6 @@ package services
import (
"context"
jsoniter "github.com/json-iterator/go"
"reflect"
"firebase.google.com/go/messaging"
@ -58,11 +57,10 @@ func NewNotification(notification models.Notification) error {
}
func PushNotification(notification models.Notification) error {
raw, _ := jsoniter.Marshal(notification)
for conn := range wsConn[notification.RecipientID] {
_ = conn.WriteMessage(1, models.UnifiedCommand{
Action: "notifications.new",
Payload: raw,
Payload: notification,
}.Marshal())
}