Fixed: starting a group chat shouldn't show the section to fetch more messages.

This commit is contained in:
Andrei Smirnov 2021-07-01 16:48:47 +03:00 committed by Iuri Matias
parent 6f55c51ff2
commit 7255dcd256
2 changed files with 17 additions and 4 deletions

View File

@ -171,6 +171,13 @@ QtObject:
proc muted*(self: ChatItemView): bool {.slot.} =
return ?.self.chatItem.muted
proc joined*(self: ChatItemView): string {.slot.} =
if self.chatItem.isNil: return ""
return $self.chatItem.joined
QtProperty[string] joined:
read = joined
QtProperty[bool] muted:
read = muted
notify = mutedChanged

View File

@ -283,13 +283,20 @@ Item {
id: fetchMoreMessagesButtonComponent
Item {
id: wrapper
property int gapNowAndOldest: nextMessageIndex > -1 ? (Date.now() / 1000 - nextMsgTimestamp / 1000) : 0
property int gapNowAndJoined: Date.now() / 1000 - +chatsModel.channelView.activeChannel.joined / 1000
visible: {
return gapNowAndOldest < Constants.maxNbDaysToFetch * Constants.fetchRangeLast24Hours
&& gapNowAndJoined > Constants.maxNbDaysToFetch * Constants.fetchRangeLast24Hours
&& (chatsModel.activeChannel.chatType !== Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.isMember)
}
height: childrenRect.height + Style.current.smallPadding * 2
anchors.left: parent.left
anchors.right: parent.right
Separator {
id: sep1
}
Loader {
id: fetchLoaderIndicator
anchors.top: sep1.bottom
@ -302,7 +309,6 @@ Item {
height: 12
}
}
StyledText {
id: fetchMoreButton
font.weight: Font.Medium