🐛 Fix push notification to wrong person

This commit is contained in:
LittleSheep 2024-07-21 22:52:24 +08:00
parent 6350ec1e43
commit d08b7a273d
2 changed files with 6 additions and 13 deletions

15
.idea/workspace.xml generated
View File

@ -4,18 +4,9 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Support stream controller event emit">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":recycle: Use dealer postman instead of built-in feature to deliver email and notify">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/external_apns.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/external_firebase.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/factors.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/factors.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/mailer.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/notifications.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/tokens.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/tokens.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/main.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/settings.toml" beforeDir="false" afterPath="$PROJECT_DIR$/settings.toml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -162,7 +153,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value=":bug: Fix disturbable condition" />
<MESSAGE value=":sparkles: Admin notify all API" />
<MESSAGE value=":bug: Fix request body validation" />
<MESSAGE value=":bug: Fix API mapping issue" />
@ -187,7 +177,8 @@
<MESSAGE value=":bug: Fix model relation issue" />
<MESSAGE value=":arrow_up: Upgrade dealer" />
<MESSAGE value=":sparkles: Support stream controller event emit" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Support stream controller event emit" />
<MESSAGE value=":recycle: Use dealer postman instead of built-in feature to deliver email and notify" />
<option name="LAST_COMMIT_MESSAGE" value=":recycle: Use dealer postman instead of built-in feature to deliver email and notify" />
</component>
<component name="VgoProject">
<settings-migrated>true</settings-migrated>

View File

@ -148,7 +148,9 @@ func PushNotificationBatch(notifications []models.Notification) {
var providers []string
var tokens []string
for _, subscriber := range subscribers {
for _, subscriber := range lo.Filter(subscribers, func(item models.NotificationSubscriber, index int) bool {
return item.AccountID == notification.AccountID
}) {
providers = append(providers, subscriber.Provider)
tokens = append(tokens, subscriber.DeviceToken)
}