Skip to content

Commit

Permalink
fix: No app slug in disk quota push notification (#4070)
Browse files Browse the repository at this point in the history
Don't include the app's slug in the disk quota push notification
title.
  • Loading branch information
taratatach authored Jul 26, 2023
2 parents 60bc67f + 37752af commit 9ca12d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions docs/flagship.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ token, the stack will then try to send the notification to the flagship apps.
If it fails again, the stack then fallbacks on email.

If the notification is sent to the flagship app, the title is modified to
preprend the application name. The name is taken from the `appName` field of
the additional parameters (`data`). It allows the user to have more context
when reading the notification on their mobile.
preprend the application name. By default, the notification `slug` is used but,
if present, the name is taken from the `appName` field of the additional
parameters (`data`). It allows the user to have more context when reading the
notification on their mobile. The `data.appName` field can also be used to
completely remove the application name from the notification title if set to an
empty string.
1 change: 1 addition & 0 deletions model/notification/center/notification_center.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func init() {
"CozyDriveLink": cozyDriveLink.String(),

// For mobile push notification
"appName": "",
"redirectLink": redirectLink,
},
PreferredChannels: []string{"mobile"},
Expand Down
4 changes: 3 additions & 1 deletion worker/push/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ func Worker(ctx *job.WorkerContext) error {
if str, ok := msg.Data["appName"].(string); ok {
name = str
}
msg.Title = fmt.Sprintf("%s - %s", name, msg.Title)
if name != "" {
msg.Title = fmt.Sprintf("%s - %s", name, msg.Title)
}
for _, c := range cs {
if _, ok := seen[c.NotificationDeviceToken]; ok {
continue
Expand Down

0 comments on commit 9ca12d3

Please sign in to comment.