From 1f02ae26f68a8c5419295d1cf50da5cca5490acc Mon Sep 17 00:00:00 2001 From: Krispire Admin Date: Mon, 8 Jun 2026 18:42:31 +0530 Subject: [PATCH] fix: push notification fix --- internal/service/notification_service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/service/notification_service.go b/internal/service/notification_service.go index 8aba9df..bb4148e 100644 --- a/internal/service/notification_service.go +++ b/internal/service/notification_service.go @@ -185,7 +185,7 @@ func (s *NotificationService) SendReminder(ctx context.Context, userID, kind, ti // Web Push (reaches closed apps). 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). @@ -239,10 +239,17 @@ func (s *NotificationService) publishPush(ctx context.Context, recipientID, kind Title: title, Body: body, URL: url, + Icon: s.iconURL(), 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) { data := map[string]any{ "RecipientName": recipient.Name,