Load all room members when showing a room to user

This commit is contained in:
miruka 2020-04-16 16:08:35 -04:00
parent 99d59bb49b
commit 744c6f1b3f
2 changed files with 20 additions and 0 deletions

View File

@ -740,6 +740,13 @@ class MatrixClient(nio.AsyncClient):
) )
async def load_all_room_members(self, room_id: str) -> None:
room = self.all_rooms[room_id]
if not room.members_synced:
await super().joined_members(room_id)
async def load_past_events(self, room_id: str) -> bool: async def load_past_events(self, room_id: str) -> bool:
"""Ask the server for 100 previous events of the room. """Ask the server for 100 previous events of the room.

View File

@ -13,9 +13,11 @@ HColumnPage {
rightPadding: 0 rightPadding: 0
onLoadEventListChanged: if (loadEventList) loadedOnce = true onLoadEventListChanged: if (loadEventList) loadedOnce = true
Component.onDestruction: if (loadMembersFuture) loadMembersFuture.cancel()
property bool loadedOnce: false property bool loadedOnce: false
property var loadMembersFuture: null
readonly property alias composer: composer readonly property alias composer: composer
readonly property bool loadEventList: readonly property bool loadEventList:
@ -23,6 +25,17 @@ HColumnPage {
! mainUI.mainPane.visible : ! pageLoader.appearAnimation.running ! mainUI.mainPane.visible : ! pageLoader.appearAnimation.running
Timer {
interval: 200
running: true
onTriggered: loadMembersFuture = py.callClientCoro(
chat.userId,
"load_all_room_members",
[chat.roomId],
() => { loadMembersFuture = null },
)
}
RoomHeader { RoomHeader {
Layout.fillWidth: true Layout.fillWidth: true
} }