Add flag-related email notifications for flagged player and offline opponent#668
Conversation
Agent-Logs-Url: https://github.com/benckx/elephantchess/sessions/64c33041-18ef-4056-8497-199fd2943f7d Co-authored-by: benckx <8626080+benckx@users.noreply.github.com>
|
@copilot actually the other player too. But they have to be offline for a while (like the other mail notifications). And there must be a checkbox in the /user/settings to enable or disable this notification. |
Agent-Logs-Url: https://github.com/benckx/elephantchess/sessions/1607d2e9-cbf3-430e-8977-17112c08f0de Co-authored-by: benckx <8626080+benckx@users.noreply.github.com>
Agent-Logs-Url: https://github.com/benckx/elephantchess/sessions/39dc1681-73c5-47cd-82b3-8a92e21ea7bc Co-authored-by: benckx <8626080+benckx@users.noreply.github.com>
Implemented in commit 781ec00: the other player is now notified too, but only when they have been offline long enough, and a new /user/settings checkbox controls this ( |
|
@copilot resolve the merge conflicts in this pull request |
|
@copilot resolve the merge conflicts in this pull request |
Done in commit |
|
@copilot resolve the merge conflicts in this pull request |
Resolved. I merged latest |
| if (email == null) { | ||
| logger.info { "not sending 'user flagged' notification for $userId in $gameId because email is null" } | ||
| } else { | ||
| mailService.sendUserFlaggedNotification( |
There was a problem hiding this comment.
@copilot We send 2 emails but we only check 1 flag. Shouldn't we have two flags? 1 for each email?
There was a problem hiding this comment.
Fixed in 21910c0 (+ follow-up ef62aac). There are now two separate notification flags: one for the flagged player email (email_notification_enabled_user_flagged) and one for the offline opponent email (email_notification_enabled_opponent_flagged), each checked independently before sending.
This change addresses missing player feedback when a user loses on time (flags). It now covers both players:
the player who flagged receives a direct notification, and
the opponent can receive an offline notification (after being offline long enough), with a user setting to enable/disable it.
Flag event now emails the flagged player
PlayerVsPlayerGameService.flagByColor(...)triggers a mail notification after a successful flag update.Flag event can now email the other player when offline
MailService.sendOpponentFlaggedWhileOffline(...)and a new template:mail_templates/opponent_flagged_while_offline.htmlNew notification preference in
/user/settingsData model and migration updates
email_notification_enabled_opponent_flaggedto user notification settings.Updated existing flagged mail API/template
MailService.sendUserFlaggedNotification(...)accepts recipient email and sends directly to the flagged player.mail_templates/user_flagged_notification.htmlis user-facing and includes username, game ID, and game link.Template and settings coverage
MailRendererTestforuser_flagged_notification.MailRendererTestcase foropponent_flagged_while_offline.UserDaoServiceTestassertions for the new notification setting.mailService.sendUserFlaggedNotification( recipient = email, gameId = gameId, username = userCache.fetchUsernameOrDefault(userId), )