Skip to content
Snippets Groups Projects
Commit 7cfca929 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch '13-should-join-room-before-syncing-just-in-case' into 'master'

Resolve "Should join room before syncing (just in case)"

Closes #13

See merge request AlekSIS/onboarding/AlekSIS-App-Matrix!8
parents 5c6d77f5 f0f4524f
No related branches found
No related tags found
1 merge request!8Resolve "Should join room before syncing (just in case)"
Pipeline #65052 failed
...@@ -184,6 +184,10 @@ class MatrixRoom(ExtensiblePolymorphicModel): ...@@ -184,6 +184,10 @@ class MatrixRoom(ExtensiblePolymorphicModel):
) )
return r return r
def _ensure_joined(self) -> True:
r = do_matrix_request("POST", f"join/{self.room_id}")
return r
@classmethod @classmethod
def get_profiles_for_group(cls, group: Group) -> QuerySet: def get_profiles_for_group(cls, group: Group) -> QuerySet:
"""Get all profile objects for the members/owners of a group.""" """Get all profile objects for the members/owners of a group."""
...@@ -247,8 +251,13 @@ class MatrixRoom(ExtensiblePolymorphicModel): ...@@ -247,8 +251,13 @@ class MatrixRoom(ExtensiblePolymorphicModel):
space.sync() space.sync()
return None return None
def sync_room_params(self):
"""Sync all room-specific parameters, e. g. the name."""
self._ensure_joined()
def sync(self): def sync(self):
"""Sync this room.""" """Sync this room."""
self.sync_room_params()
self.sync_profiles() self.sync_profiles()
if get_site_preferences()["matrix__use_spaces"]: if get_site_preferences()["matrix__use_spaces"]:
self.sync_space() self.sync_space()
...@@ -337,6 +346,7 @@ class MatrixSpace(MatrixRoom): ...@@ -337,6 +346,7 @@ class MatrixSpace(MatrixRoom):
def sync(self): def sync(self):
"""Sync this space.""" """Sync this space."""
self.sync_room_params()
self.ensure_children() self.ensure_children()
self.sync_children() self.sync_children()
self.sync_profiles() 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