From 34edf923d0d5cf5d7b276c782c14c1f38ffbc3aa Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 15 Aug 2019 11:46:40 -0400 Subject: [PATCH] Fix past events loading error for invited room --- TODO.md | 5 +++++ src/python/matrix_client.py | 2 +- src/qml/Chat/Timeline/EventList.qml | 8 ++++++-- src/qml/Python.qml | 1 - 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index 57ca486d..7cdf6171 100644 --- a/TODO.md +++ b/TODO.md @@ -35,6 +35,11 @@ - Accept/cancel buttons - Transitions + - Restoring UI state: + - Sendbox content + - Which element was focused + - Room member filter field + - Combine events so they take less space - After combining is implemented, no need to hide our own profile changes. - Room last activity time in RoomDelegate diff --git a/src/python/matrix_client.py b/src/python/matrix_client.py index 5ff7c59f..58935ee8 100644 --- a/src/python/matrix_client.py +++ b/src/python/matrix_client.py @@ -212,7 +212,7 @@ class MatrixClient(nio.AsyncClient): async def load_past_events(self, room_id: str) -> bool: - if room_id in self.fully_loaded_rooms: + if room_id in self.fully_loaded_rooms or room_id in self.invited_rooms: return False await self.first_sync_happened.wait() diff --git a/src/qml/Chat/Timeline/EventList.qml b/src/qml/Chat/Timeline/EventList.qml index 1ee060b1..9284dcae 100644 --- a/src/qml/Chat/Timeline/EventList.qml +++ b/src/qml/Chat/Timeline/EventList.qml @@ -69,16 +69,20 @@ HRectangle { // Declaring this as "alias" provides the on... signal property real yPos: visibleArea.yPosition property bool canLoad: true - onYPosChanged: Qt.callLater(loadPastEvents) + onYPosChanged: if (canLoad && yPos < 0.1) Qt.callLater(loadPastEvents) function loadPastEvents() { - if (chatPage.invited_id || ! canLoad || yPos > 0.1) { return } eventList.canLoad = false py.callClientCoro( chatPage.userId, "load_past_events", [chatPage.roomId], moreToLoad => { eventList.canLoad = moreToLoad } ) } + + property string inviter: chatPage.roomInfo.inviter || "" + // When an invited room becomes joined, we should now be able to fetch + // past events. + onInviterChanged: canLoad = true } HNoticePage { diff --git a/src/qml/Python.qml b/src/qml/Python.qml index d97b52e7..70cf74ac 100644 --- a/src/qml/Python.qml +++ b/src/qml/Python.qml @@ -34,7 +34,6 @@ Python { function saveConfig(backend_attribute, data, callback=null) { if (! py.ready) { return } // config not loaded yet - print(backend_attribute, JSON.stringify( data, null, 4)) callCoro(backend_attribute + ".write", [data], callback) }