Fix past events loading error for invited room
This commit is contained in:
		
							
								
								
									
										5
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								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
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user