From 97c4794f5e07072d1711c9df0d8c63f10c0d4280 Mon Sep 17 00:00:00 2001 From: Darragh Van Tichelen Date: Tue, 31 Oct 2023 18:05:07 +0100 Subject: [PATCH] Fix teleport remove event no longer being sent --- CHANGELOG.md | 4 ++++ server/src/api/socket/shape/__init__.py | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8f926590..c11291879 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ tech changes will usually be stripped from release notes for the public ## Unreleased +### Fixed + +- Teleport: shapes would not be removed on the old location until a refresh + ## [2023.3.0] - 2023-09-17 ### Added diff --git a/server/src/api/socket/shape/__init__.py b/server/src/api/socket/shape/__init__.py index 233512cbb..669e482da 100644 --- a/server/src/api/socket/shape/__init__.py +++ b/server/src/api/socket/shape/__init__.py @@ -399,18 +399,22 @@ async def move_shapes(sid: str, raw_data: Any): target_layer = floor.layers.where(Layer.name == data.target.layer)[0] shapes = [] + old_floor = None for shape in _get_shapes_from_uuids(data.shapes, False): layer = target_layer if shape.layer: + if old_floor is None: + old_floor = shape.layer.floor layer = floor.layers.where(Layer.name == shape.layer.name)[0] elif layer is None: logger.warn("Attempt to move a shape without layer info") continue shapes.append((shape, layer)) - await send_remove_shapes( - [sh.uuid for sh, _ in shapes], room=floor.location.get_path() - ) + if old_floor: + await send_remove_shapes( + [sh.uuid for sh, _ in shapes], room=old_floor.location.get_path() + ) for shape, layer in shapes: shape.layer = layer