Skip to content

Commit

Permalink
bug(Teleport): Fix teleport remove event no longer being sent
Browse files Browse the repository at this point in the history
  • Loading branch information
Kruptein authored Oct 31, 2023
1 parent 6b4c387 commit 521f31d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions server/src/api/socket/shape/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 521f31d

Please sign in to comment.