When room changes category, affect the Chat too
This commit is contained in:
parent
be152c3acf
commit
a47e6b5c07
|
@ -114,7 +114,6 @@ class MatrixClient(nio.AsyncClient):
|
|||
return
|
||||
self.backend.pending_profile_requests.add(user_id)
|
||||
|
||||
print("Requesting user profile:", user_id)
|
||||
response = await self.get_profile(user_id)
|
||||
|
||||
if isinstance(response, nio.ProfileGetError):
|
||||
|
@ -171,7 +170,6 @@ class MatrixClient(nio.AsyncClient):
|
|||
)
|
||||
|
||||
more_to_load = True
|
||||
print(len(response.chunk))
|
||||
|
||||
if self.backend.past_tokens[room_id] == response.end:
|
||||
self.backend.fully_loaded_rooms.add(room_id)
|
||||
|
|
|
@ -6,16 +6,14 @@ import "Timeline"
|
|||
import "RoomSidePane"
|
||||
|
||||
HColumnLayout {
|
||||
property string userId: ""
|
||||
property string category: ""
|
||||
property string roomId: ""
|
||||
property var roomInfo: null
|
||||
|
||||
readonly property string userId: roomInfo.userId
|
||||
readonly property string category: roomInfo.category
|
||||
readonly property string roomId: roomInfo.roomId
|
||||
|
||||
readonly property var senderInfo: users.getUser(userId)
|
||||
|
||||
readonly property var roomInfo: rooms.getWhere(
|
||||
{"userId": userId, "roomId": roomId, "category": category}, 1
|
||||
)[0]
|
||||
|
||||
readonly property bool hasUnknownDevices: false
|
||||
//category == "Rooms" ?
|
||||
//Backend.clients.get(userId).roomHasUnknownDevices(roomId) : false
|
||||
|
@ -23,14 +21,6 @@ HColumnLayout {
|
|||
id: chatPage
|
||||
onFocusChanged: sendBox.setFocus()
|
||||
|
||||
//Component.onCompleted: Backend.signals.roomCategoryChanged.connect(
|
||||
//function(forUserId, forRoomId, previous, now) {
|
||||
//if (chatPage && forUserId == userId && forRoomId == roomId) {
|
||||
//chatPage.category = now
|
||||
//}
|
||||
//}
|
||||
//)
|
||||
|
||||
RoomHeader {
|
||||
id: roomHeader
|
||||
displayName: roomInfo.displayName
|
||||
|
|
|
@ -34,7 +34,7 @@ HRectangle {
|
|||
|
||||
// Keep x scroll pages cached, to limit images having to be
|
||||
// reloaded from network.
|
||||
cacheBuffer: height * 6
|
||||
cacheBuffer: height * 4
|
||||
|
||||
// Declaring this as "alias" provides the on... signal
|
||||
property real yPos: visibleArea.yPosition
|
||||
|
|
|
@ -32,17 +32,19 @@ function onRoomUpdated(
|
|||
"name": category
|
||||
})
|
||||
|
||||
function pop(for_category) {
|
||||
rooms.popWhere(
|
||||
function find(for_category) {
|
||||
var found = rooms.getIndices(
|
||||
{"userId": user_id, "roomId": room_id, "category": for_category}, 1
|
||||
)
|
||||
return found.length > 0 ? found[0] : null
|
||||
}
|
||||
|
||||
if (category == "Invites") { pop("Rooms"); pop("Left") }
|
||||
else if (category == "Rooms") { pop("Invites"); pop("Left") }
|
||||
else if (category == "Left") { pop("Invites"); pop("Rooms") }
|
||||
var replace = null
|
||||
if (category == "Invites") { replace = find("Rooms") || find("Left") }
|
||||
else if (category == "Rooms") { replace = find("Invites") || find("Left") }
|
||||
else if (category == "Left") { replace = find("Invites") || find("Rooms")}
|
||||
|
||||
rooms.upsert({"userId": user_id, "roomId": room_id, "category": category},{
|
||||
var item = {
|
||||
"userId": user_id,
|
||||
"category": category,
|
||||
"roomId": room_id,
|
||||
|
@ -51,7 +53,18 @@ function onRoomUpdated(
|
|||
"topic": topic,
|
||||
"typingText": typingTextFor(typing_members, user_id),
|
||||
"inviterId": inviter_id
|
||||
})
|
||||
}
|
||||
|
||||
if (replace === null) {
|
||||
rooms.upsert(
|
||||
{"userId": user_id, "roomId": room_id, "category": category},
|
||||
item
|
||||
)
|
||||
} else {
|
||||
print("re", replace, display_name)
|
||||
rooms.set(replace, item)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -70,10 +70,13 @@ Item {
|
|||
}
|
||||
|
||||
function showRoom(userId, category, roomId) {
|
||||
pageStack.replace(
|
||||
"Chat/Chat.qml",
|
||||
{ userId: userId, category: category, roomId: roomId }
|
||||
)
|
||||
var info = rooms.getWhere({
|
||||
"userId": userId,
|
||||
"roomId": roomId,
|
||||
"category": category
|
||||
}, 1)[0]
|
||||
|
||||
pageStack.replace("Chat/Chat.qml", {"roomInfo": info})
|
||||
}
|
||||
|
||||
Component.onCompleted: initialRoomTimer.start()
|
||||
|
|
Loading…
Reference in New Issue
Block a user