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.} = proc muted*(self: ChatItemView): bool {.slot.} =
return ?.self.chatItem.muted 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: QtProperty[bool] muted:
read = muted read = muted
notify = mutedChanged notify = mutedChanged

View File

@ -283,14 +283,21 @@ Item {
id: fetchMoreMessagesButtonComponent id: fetchMoreMessagesButtonComponent
Item { Item {
id: wrapper 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 height: childrenRect.height + Style.current.smallPadding * 2
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
Separator { Separator {
id: sep1 id: sep1
} }
Loader {
Loader {
id: fetchLoaderIndicator id: fetchLoaderIndicator
anchors.top: sep1.bottom anchors.top: sep1.bottom
anchors.topMargin: Style.current.padding anchors.topMargin: Style.current.padding
@ -301,8 +308,7 @@ Item {
width: 12 width: 12
height: 12 height: 12
} }
} }
StyledText { StyledText {
id: fetchMoreButton id: fetchMoreButton
font.weight: Font.Medium font.weight: Font.Medium