Update chatPage properly when roomCategory changes

This commit is contained in:
miruka
2019-05-06 14:06:28 -04:00
parent cdf6190cba
commit d6714141e0
6 changed files with 46 additions and 14 deletions

View File

@@ -21,7 +21,6 @@ Banner {
buttonCallbacks: {
"forget": function(button) {
button.loading = true
chatPage.canLoadPastEvents = false
Backend.clients.get(chatPage.userId).forgetRoom(chatPage.roomId)
pageStack.clear()
},

View File

@@ -14,11 +14,17 @@ HColumnLayout {
.roomCategories.get(category)
.rooms.get(roomId)
property bool canLoadPastEvents: true
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 {
displayName: roomInfo.displayName
topic: roomInfo.topic || ""

View File

@@ -2,7 +2,6 @@ import QtQuick 2.7
import "../../Base"
HGlassRectangle {
property bool canLoadPastEvents: true
property int space: 8
color: HStyle.chat.roomEventList.background
@@ -29,7 +28,7 @@ HGlassRectangle {
property real yPos: visibleArea.yPosition
onYPosChanged: {
if (chatPage.canLoadPastEvents && yPos <= 0.1) {
if (chatPage.category != "Invites" && yPos <= 0.1) {
Backend.loadPastEvents(chatPage.roomId)
}
}