Skip to content
Snippets Groups Projects
Verified Commit f0f4524f authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Ensure that the bot user has joined the respective room

parent 5c6d77f5
No related branches found
No related tags found
1 merge request!8Resolve "Should join room before syncing (just in case)"
Checking pipeline status
......@@ -184,6 +184,10 @@ class MatrixRoom(ExtensiblePolymorphicModel):
)
return r
def _ensure_joined(self) -> True:
r = do_matrix_request("POST", f"join/{self.room_id}")
return r
@classmethod
def get_profiles_for_group(cls, group: Group) -> QuerySet:
"""Get all profile objects for the members/owners of a group."""
......@@ -247,8 +251,13 @@ class MatrixRoom(ExtensiblePolymorphicModel):
space.sync()
return None
def sync_room_params(self):
"""Sync all room-specific parameters, e. g. the name."""
self._ensure_joined()
def sync(self):
"""Sync this room."""
self.sync_room_params()
self.sync_profiles()
if get_site_preferences()["matrix__use_spaces"]:
self.sync_space()
......@@ -337,6 +346,7 @@ class MatrixSpace(MatrixRoom):
def sync(self):
"""Sync this space."""
self.sync_room_params()
self.ensure_children()
self.sync_children()
self.sync_profiles()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment