fix: push notification fix
This commit is contained in:
@@ -185,7 +185,7 @@ func (s *NotificationService) SendReminder(ctx context.Context, userID, kind, ti
|
|||||||
|
|
||||||
// Web Push (reaches closed apps).
|
// Web Push (reaches closed apps).
|
||||||
if s.push != nil {
|
if s.push != nil {
|
||||||
s.push.SendToUser(ctx, userID, PushPayload{Title: title, Body: body, URL: url, Tag: kind, RequireInteraction: true})
|
s.push.SendToUser(ctx, userID, PushPayload{Title: title, Body: body, URL: url, Icon: s.iconURL(), Tag: kind, RequireInteraction: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Email (only if there's an address on file).
|
// Email (only if there's an address on file).
|
||||||
@@ -239,10 +239,17 @@ func (s *NotificationService) publishPush(ctx context.Context, recipientID, kind
|
|||||||
Title: title,
|
Title: title,
|
||||||
Body: body,
|
Body: body,
|
||||||
URL: url,
|
URL: url,
|
||||||
|
Icon: s.iconURL(),
|
||||||
Tag: kind,
|
Tag: kind,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// iconURL is the absolute URL of the notification icon (the app's square
|
||||||
|
// icon), so it renders regardless of the client's base path.
|
||||||
|
func (s *NotificationService) iconURL() string {
|
||||||
|
return strings.TrimRight(s.frontendURL, "/") + "/icon-192.png"
|
||||||
|
}
|
||||||
|
|
||||||
func (s *NotificationService) render(kind string, recipient, actor *model.User) (string, error) {
|
func (s *NotificationService) render(kind string, recipient, actor *model.User) (string, error) {
|
||||||
data := map[string]any{
|
data := map[string]any{
|
||||||
"RecipientName": recipient.Name,
|
"RecipientName": recipient.Name,
|
||||||
|
|||||||
Reference in New Issue
Block a user