aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_room_insert_remove.go
diff options
context:
space:
mode:
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)