feat: hide fetch old messages after 30 days

This commit is contained in:
Jonathan Rainville 2021-02-12 14:27:37 -05:00 committed by Iuri Matias
parent 90e9e2d192
commit 3fef5c7a69
2 changed files with 9 additions and 2 deletions

View File

@ -167,8 +167,14 @@ Item {
Component {
id: fetchMoreMessagesButtonComponent
Item {
visible: chatsModel.activeChannel.chatType !== Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.isMember
id: wrapper
property int gapNowAndOldestTimestamp: Date.now() / 1000 - chatsModel.oldestMsgTimestamp
visible: {
return gapNowAndOldestTimestamp < Constants.maxNbDaysToFetch * Constants.fetchRangeLast24Hours &&
(chatsModel.activeChannel.chatType !== Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.isMember)
}
id: wrapper
height: wrapper.visible ? childrenRect.height + Style.current.smallPadding*2 : 0
anchors.left: parent.left
anchors.right: parent.right

View File

@ -13,6 +13,7 @@ QtObject {
readonly property int communityChatInvitationOnlyAccess: 2
readonly property int communityChatOnRequestAccess: 3
readonly property int maxNbDaysToFetch: 30
readonly property int fetchRangeLast24Hours: 86400
readonly property int fetchRangeLast2Days: 172800
readonly property int fetchRangeLast3Days: 259200