Repository navigation
Keep ban templates for the ban dialog, and edit an active ban under a permission of its own - #62
Merged
Merged
Conversation
… an active ban under a permission of its own, each edit kept
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One commit and two merges of
main. Who may change the settings keeps a list of ban templates, each a reason and a length, and the ban dialog offers them: picking one fills in the reason and the length, which the staff can still change before banning. An active ban can now be edited, its reason, its end or both, under a permission of its own, Edit bans. Each edit is kept with the ban, with who made it, when, and what it replaced; the audit log, the Bans page and the player's profile show them, and a connecting player is checked against the ban as it now stands. The bridge and the contract do not change.What changed
Ban templates (
8c7d166)crates/observer-domain/src/bans.rs:BanTemplate(reason,minutes, null for a permanent ban) andBansSettings::templates.checkedkeeps a template only with a reason a ban takes and a length from a minute to ten years, keeps a template listed twice once, and takes 50 at most.crates/observer-store/migrations/0019_ban_edits_templates.sql: tableban_template, in the settings' order. They are saved with the refusal message throughPUT /api/servers/default/bans/settings, with the settings' permission and the password again, and that body now requirestemplates: a client that leaves it out is refused rather than emptying the list.GET /api/servers/default/bans/templatesgives them to whoever bans (PLAYERS_BAN).Editing an active ban (
8c7d166)PATCH /api/servers/default/bans/{code}takesBanEditRequest: a newreason, a new end (ends:never, orina number of minutes counted from the edit), or both. Only an active ban is edited (ban_not_found,ban_not_active); an edit that changes nothing is not kept, and the schema refuses one.BANS_EDIT(bit 32, sensitive, area Players, impliesBANS_VIEW): the end moves either way, sooner included.ban_edit, in the same migration: who made each edit, when, and the reason and the end before and after. The ban keeps who made it and when.Ban::editslists them, latest first, in the list, a profile's bans and the edit's answer.ban_edited; its details holdreasonandendsAt, whichever changed, each before and after.playerConnecting, the drop of a connected player and the eventsobserver:playerRefusedandobserver:playerBannedread the ban as it is stored, so they carry the new reason and end.web/src/bans/fields.tsx: the length choice, the reason field and the range hint, which the ban dialog, the edit dialog and the template dialog share.The audit details of the bans' settings (
8c7d166):bans_settings_changednow names each changed setting with its value before and after (refusalMessage,tokenMatches,templates), rather than the whole settings twice; the audit log words the templates as reasons and lengths.README (
8c7d166): the Bans section.Merges of
main(6270411,fd8fa6c)6270411merged Run the fake FXServer tests on ports the system gives, so that two runs on one host no longer collide #56, Follow the server's resources on a Resources page, and start, stop, restart or rescan them #57, Show the integration contract in the panel, on a Documentation page drawn from the file the binary ships #59 and List the server's entities, draw them on the live map and delete them a hundred at a time #61. Follow the server's resources on a Resources page, and start, stop, restart or rescan them #57 and List the server's entities, draw them on the live map and delete them a hundred at a time #61 took bits 26 to 28, soBANS_EDITmoved after them;AuditAction::ALLwas counted again. The bindings were generated again from the merged Rust.fd8fa6cmerged Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58, which took bits 29 to 31:BANS_EDITis bit 32, and the owner's mask incrates/observer-web/src/tests.rsis1ffffffff;AuditAction::ALLholds 123 actions.Bans::bankeeps Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58's txAdmin event andBansSettings::checkeditsclean_message(text, max). The settings' category is Bans and kicks, the kick message after the templates. The refusal message's audit detail is keyedrefusalMessage, since Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58 givesmessageits own label for announcements, and the fixture of Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58's kick message tests gainstemplates: [].Why
The ban dialog offered lengths only, while most bans are for a handful of reasons; txAdmin keeps templates for them. And a ban could not be corrected: a typo in a reason the player reads, or a wrong length, meant lifting it and banning again under a new ban ID, the one the player quotes to appeal.
Notes for review
crates/observer-store/src/migrations.rsfor both, andweb/src/audit/details.tsfor Let in approved players only, and close the server for maintenance to all but a list, under another name in the server list, in contract 6 #60.Verified
cargo xtask checkon Windows atfd8fa6c: fmt, icons, clippy with-D warningswith and withouttest-catalog, 3,475 Rust tests in 49 test binaries, none failed, bindings unchanged, and inweb/format, lint, type check, 925 tests and the build, under Node 26.13. GitHub Actions starts no job, as on the PRs before this one: this local run stands in for it.crates/observer-store: a 0018 database keeps its bans through the migration, with no edit and no template.8c7d166: a player whose ban was edited twice is refused at connection with the new reason and end, in the message and inobserver:playerRefused.PATCHanswers403bansEditto an account that bans or lifts without the permission, and200to one that holds it. The Bans page, the profile, the three dialogs and the settings' row seen at 1440, 1024, 375 and 320 px, dark and light, with no console error and nothing scrolling sideways, on the dev server and on the panel the debug Observer serves.Not verified
cargo xtask e2e: no flow covers bans.