Fix: completer gets email but not push notification

- Push notification: sent to all users EXCEPT completer
- Email: sent to ALL users INCLUDING completer

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-11-26 23:31:00 -06:00
parent b05ee453c7
commit eed5c21586

View File

@@ -519,14 +519,12 @@ func (s *TaskService) sendTaskCompletedNotification(task *models.Task, completio
"completion_id": completion.ID, "completion_id": completion.ID,
} }
// Notify all users except the one who completed the task // Notify all users
for _, user := range users { for _, user := range users {
if user.ID == completion.CompletedByID { isCompleter := user.ID == completion.CompletedByID
continue // Don't notify the person who completed it
}
// Send push notification // Send push notification (to everyone EXCEPT the person who completed it)
if s.notificationService != nil { if !isCompleter && s.notificationService != nil {
go func(userID uint) { go func(userID uint) {
ctx := context.Background() ctx := context.Background()
if err := s.notificationService.CreateAndSendNotification( if err := s.notificationService.CreateAndSendNotification(
@@ -542,7 +540,7 @@ func (s *TaskService) sendTaskCompletedNotification(task *models.Task, completio
}(user.ID) }(user.ID)
} }
// Send email notification // Send email notification (to everyone INCLUDING the person who completed it)
if s.emailService != nil && user.Email != "" { if s.emailService != nil && user.Email != "" {
go func(u models.User) { go func(u models.User) {
if err := s.emailService.SendTaskCompletedEmail( if err := s.emailService.SendTaskCompletedEmail(