aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_room_insert_remove.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-07 17:04:00 -0400
committerhistoria <[not public]>2026-07-07 17:04:00 -0400
commitbae42946d24bd533cdbc1b271ce14acd752689d0 (patch)
treefee984aead607deb7ba14e8736ff2cda942b9642 /internal/admin/api_room_insert_remove.go
parent726997d799edc388cd448e978d5bb0755aaa551c (diff)
downloadthehouseoficarus-bae42946d24bd533cdbc1b271ce14acd752689d0.tar.gz
feat: standardize new room names to Room #<id>
Diffstat (limited to 'internal/admin/api_room_insert_remove.go')
-rw-r--r--internal/admin/api_room_insert_remove.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/admin/api_room_insert_remove.go b/internal/admin/api_room_insert_remove.go
index c5ed54a..8549d76 100644
--- a/internal/admin/api_room_insert_remove.go
+++ b/internal/admin/api_room_insert_remove.go
@@ -66,11 +66,6 @@ func (s *AdminServer) handleRoomInsert(w http.ResponseWriter, r *http.Request) {
return
}
- name := strings.TrimSpace(body.Name)
- if name == "" {
- name = "New Room"
- }
-
aPath, aPathOK := s.world.GetRoomPath(aID)
if !aPathOK {
writeJSONError(w, fmt.Sprintf("could not find the file for room #%d", aID), http.StatusInternalServerError)
@@ -83,6 +78,11 @@ func (s *AdminServer) handleRoomInsert(w http.ResponseWriter, r *http.Request) {
return
}
+ name := strings.TrimSpace(body.Name)
+ if name == "" {
+ name = fmt.Sprintf("Room #%d", newID)
+ }
+
// Grid-conflict check on a hypothetical post-insert world.
conflicts := world.InsertGridConflicts(aID, dir, bID, newID, func(id int) (*world.Room, bool) {
r, err := s.world.LoadRoom(id)