fix(@desktop/chat): navigating from Chats to Timeline shows wrong messages

This commit is contained in:
Andrei Smirnov 2021-07-12 12:06:04 +03:00 committed by Iuri Matias
parent 0eab4009ba
commit 3bb5be8685
4 changed files with 7 additions and 9 deletions

View File

@ -144,6 +144,7 @@ QtObject:
proc activeChannelChanged*(self: ChatsView) {.slot.} =
self.channelView.activeChannelChanged()
self.messageView.activeChannelChanged()
self.triggerActiveChannelChange()
proc getMessageView*(self: ChatsView): QVariant {.slot.} = newQVariant(self.messageView)
@ -413,9 +414,6 @@ QtObject:
self.channelView.setActiveChannel(channel)
self.messageView.activeChannelChanged()
# proc activeChannelChanged*(self: ChatsView) =
# self.channelView.activeChannelChanged()
proc requestMoreMessages*(self: ChatsView, fetchRange: int) {.slot.} =
self.messageView.loadingMessages = true
self.messageView.loadingMessagesChanged(true)

View File

@ -118,16 +118,16 @@ SplitView {
radius: 16
}
onClicked: {
root.newMessages = 0
svRoot.newMessages = 0
scrollDownButton.visible = false
chatLogView.scrollToBottom(true)
}
StyledText {
id: nbMessages
visible: root.newMessages > 0
visible: svRoot.newMessages > 0
width: visible ? implicitWidth : 0
text: root.newMessages
text: svRoot.newMessages
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
color: Style.current.pillButtonTextColor
@ -194,7 +194,7 @@ SplitView {
onNewMessagePushed: {
if (!chatLogView.scrollToBottom()) {
root.newMessages++
svRoot.newMessages++
}
}

View File

@ -305,7 +305,7 @@ Item {
visible: {
return gapNowAndOldest < maxGapInSeconds
&& gapNowAndJoined > maxGapInSeconds
&& (chatsModel.activeChannel.chatType !== Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.isMember)
&& (chatsModel.channelView.activeChannel.chatType !== Constants.chatTypePrivateGroupChat || chatsModel.channelView.activeChannel.isMember)
}
height: childrenRect.height + Style.current.smallPadding * 2
anchors.left: parent.left

View File

@ -121,7 +121,7 @@ ScrollView {
function(left, right) { return left.clock > right.clock }
]
model: chatsModel.messageList
model: chatsModel.messageView.messageList
delegate: Message {
id: msgDelegate
fromAuthor: model.fromAuthor