Skip to content

Commit

Permalink
Merge pull request #264 from seatsurfing/fix-262
Browse files Browse the repository at this point in the history
Fix issue #262
  • Loading branch information
virtualzone authored Aug 28, 2024
2 parents 9cc5976 + 890ab08 commit 58128af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions admin-ui/src/pages/locations/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,23 @@ class EditLocation extends React.Component<Props, State> {
}

saveSpaces = async () => {
// Fetch the latest list of spaces from the server to avoid overwriting
let spaces = await Space.list(this.entity.id);

// For spaces on the "to be deleted"-list, delete them and clear the list afterwards
for (let space of spaces) {
if (this.state.deleteIds.indexOf(space.id) > -1) {
await space.delete();
}
}
this.setState({deleteIds: []});

// Sync all other spaces to the server
for (let item of this.state.spaces) {
let space: Space = new Space();
spaces.forEach((spaceItem) => {
if (item.id === spaceItem.id) {
space = spaceItem
}
});
if (item.id) {
space.id = item.id;
}
space.locationId = this.entity.id;
space.name = item.name;
space.x = item.x;
Expand All @@ -145,6 +149,7 @@ class EditLocation extends React.Component<Props, State> {
space.height = parseInt(item.height.replace(/^\D+/g, ''));
space.rotation = item.rotation;
await space.save();
item.id = space.id; // Store id (if created)
}
}

Expand Down
2 changes: 1 addition & 1 deletion server/res/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19.0
1.19.1

0 comments on commit 58128af

Please sign in to comment.