Improve admin message seen/dismiss state. (#26223)

Fixes #26211

Admin messages now have separate "seen" and "dismissed" fields. The idea is that an admin should be able to tell whether a user pressed the "dismiss for now" button. Instead of using "seen" as "show this message to players when they join", "dismissed" is now used for this.

Existing notes in the database will automatically be marked as dismissed on migration. A note cannot be dismissed without being seen (enforced via constraint in the database too, aren't I fancy).

As part of this, it has become impossible for a player to play without dismissing the message in some form. Instead of a shitty popup window, the popup is now a fullscreen overlay that blocks clicks behind it, making the game unplayable. Also, if a user somehow has multiple messages they will be combined into one popup.

Also I had enough respect for the codebase to make it look better and clean up the code somewhat. Yippee.
This commit is contained in:
Pieter-Jan Briers
2024-03-21 16:15:46 +01:00
committed by GitHub
parent f87480dd36
commit d776c4b392
21 changed files with 3748 additions and 108 deletions

View File

@@ -23,8 +23,11 @@ admin-notes-hide = Hide
admin-notes-delete-confirm = Confirm delete
admin-notes-edited = Last edit by {$author} on {$date}
admin-notes-unbanned = Unbanned by {$admin} on {$date}
admin-notes-message-window-title = Alert!
admin-notes-message-admin = New message from {$admin}, added on {$date}
admin-notes-message-desc = [color=white]You have received { $count ->
[1] an administrative message
*[other] administrative messages
} since the last time you played on this server.[/color]
admin-notes-message-admin = From [bold]{ $admin }[/bold], written on { TOSTRING($date, "f") }:
admin-notes-message-wait = The accept button will be enabled after {$time} seconds.
admin-notes-message-accept = Dismiss permanently
admin-notes-message-dismiss = Dismiss for now
@@ -68,6 +71,7 @@ admin-notes-verb-text = Open Admin Notes
# Watchlist and message login
admin-notes-watchlist = Watchlist for {$player}: {$message}
admin-notes-new-message = You've received an admin message from {$admin}: {$message}
admin-notes-fallback-admin-name = [System]
# Admin remarks
admin-remarks-command-description = Opens the admin remarks page