mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-12 15:54:52 +09:00
Add a watch list and read state to exp_reports
Players on the watch list are announced to every online admin on every instance when they join, and the join is posted to the Discord and JSON webhooks. The Reports page has a second table for the watch list with an Add button and a Delete button per row. Reports can be marked read or unread from the web interface. Each report row also has an Add to watch list button which opens the add form filled in with the player and reason. Setting exp_reports.watch_unread_reports treats players with unread reports as watched. Reports now store created_at_ms because marking them read changes updated_at_ms. Old reports.json files migrate on load with updated_at_ms as the creation time. The report webhook moved from the datastore update listener to the create handler so reading a report is not posted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82abc2c332
commit
44ae3a5f0e
14 files changed
+826
-43
No files matched your search
@@ -40,8 +40,16 @@ local ExpReports = {
|
||||
--- @field by_player_name string
|
||||
--- @field reason string
|
||||
--- @field instance_name string
|
||||
--- @field created_at_ms number
|
||||
--- @field is_read boolean?
|
||||
--- @field updated_at_ms number
|
||||
|
||||
--- @class ExpReports.WatchListEntry
|
||||
--- @field player_name string
|
||||
--- @field reason string
|
||||
--- @field by_player_name string
|
||||
--- @field created_at_ms number
|
||||
|
||||
local error_settings = { color = ExpUtil.color.orange_red, sound_path = "utility/wire_pickup" }
|
||||
|
||||
--- Report a player, the outcome is printed once the controller answers
|
||||
@@ -194,6 +202,24 @@ function ExpReports.receive_deleted(payload)
|
||||
})
|
||||
end
|
||||
|
||||
--- A watched player joined an instance, which may be another one, admins are told why they are watched
|
||||
--- @param payload { player_name: string, instance_name: string, watch_list_entry: ExpReports.WatchListEntry?, unread_reports: ExpReports.Report[] }
|
||||
function ExpReports.receive_watched_joined(payload)
|
||||
local player_name = format_player_name(payload.player_name)
|
||||
local entry = payload.watch_list_entry
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if player.admin then
|
||||
player.print{ "exp-reports.watched-joined", player_name, payload.instance_name }
|
||||
if entry then
|
||||
player.print{ "exp-reports.watched-entry", format_player_name(entry.by_player_name), entry.reason }
|
||||
end
|
||||
for _, report in ipairs(payload.unread_reports) do
|
||||
player.print{ "exp-reports.watched-report", format_player_name(report.by_player_name), report.reason }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- The controller refused a request, the message is printed to whoever asked
|
||||
--- @param payload { caller: string, message: string }
|
||||
function ExpReports.receive_error(payload)
|
||||
|
||||
Reference in new issue
Block a user