diff --git a/go-backend/internal/models/notification.go b/go-backend/internal/models/notification.go index cc264be..150e3c9 100644 --- a/go-backend/internal/models/notification.go +++ b/go-backend/internal/models/notification.go @@ -112,6 +112,7 @@ type PushNotificationRequest struct { ActorID uuid.UUID ActorName string ActorAvatar string + ActorHandle string PostID *uuid.UUID CommentID *uuid.UUID PostType string // "standard", "quip", "beacon" diff --git a/go-backend/internal/services/notification_service.go b/go-backend/internal/services/notification_service.go index 458be8e..ad98a61 100644 --- a/go-backend/internal/services/notification_service.go +++ b/go-backend/internal/services/notification_service.go @@ -222,6 +222,9 @@ func (s *NotificationService) sendNotification(ctx context.Context, req models.P if actor.AvatarURL != nil { req.ActorAvatar = *actor.AvatarURL } + if actor.Handle != nil { + req.ActorHandle = *actor.Handle + } // Create in-app notification record notif := &models.Notification{ @@ -300,6 +303,9 @@ func (s *NotificationService) buildPushPayload(req models.PushNotificationReques if req.CommentID != nil { data["comment_id"] = req.CommentID.String() } + if req.ActorHandle != "" { + data["actor_handle"] = req.ActorHandle + } if req.PostType != "" { data["post_type"] = req.PostType } @@ -335,12 +341,20 @@ func (s *NotificationService) buildPushPayload(req models.PushNotificationReques case models.NotificationTypeFollow: title = "New Follower" body = fmt.Sprintf("%s started following you", actorName) - data["follower_id"] = req.ActorID.String() + if req.ActorHandle != "" { + data["follower_id"] = req.ActorHandle + } else { + data["follower_id"] = req.ActorID.String() + } case models.NotificationTypeFollowRequest: title = "Follow Request" body = fmt.Sprintf("%s wants to follow you", actorName) - data["follower_id"] = req.ActorID.String() + if req.ActorHandle != "" { + data["follower_id"] = req.ActorHandle + } else { + data["follower_id"] = req.ActorID.String() + } case models.NotificationTypeFollowAccept: title = "Request Accepted" @@ -364,6 +378,10 @@ func (s *NotificationService) buildPushPayload(req models.PushNotificationReques body = fmt.Sprintf("%s reported your beacon", actorName) data["beacon_id"] = req.PostID.String() + case models.NotificationTypeQuipReaction: + title = "New Reaction" + body = fmt.Sprintf("%s reacted to your quip", actorName) + default: title = "Sojorn" body = "You have a new notification" @@ -380,6 +398,8 @@ func (s *NotificationService) getNavigationTarget(notifType, postType string) st return "profile" case models.NotificationTypeBeaconVouch, models.NotificationTypeBeaconReport: return "beacon_map" + case models.NotificationTypeQuipReaction: + return "quip_feed" default: switch postType { case "beacon":