mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 14:26:34 +00:00
fix: code review
This commit is contained in:
parent
e76e936d2b
commit
4a9f63c59a
@ -498,31 +498,23 @@ QtObject:
|
||||
write = setLoadingMessages
|
||||
notify = loadingMessagesChanged
|
||||
|
||||
proc requestMoreTimelineMessages*(self: ChatsView, fetchRange: int) {.slot.} =
|
||||
proc requestMoreMessages*(self: ChatsView, fetchRange: int) {.slot.} =
|
||||
self.loadingMessages = true
|
||||
self.loadingMessagesChanged(true)
|
||||
|
||||
var allTopics: seq[string] = @[]
|
||||
for contact in self.status.contacts.getContacts():
|
||||
for t in self.status.mailservers.getMailserverTopicsByChatId(getTimelineChatId(contact.id)).map(topic => topic.topic):
|
||||
allTopics.add(t)
|
||||
if(self.activeChannel.isTimelineChat):
|
||||
for contact in self.status.contacts.getContacts():
|
||||
for t in self.status.mailservers.getMailserverTopicsByChatId(getTimelineChatId(contact.id)).map(topic => topic.topic):
|
||||
allTopics.add(t)
|
||||
else:
|
||||
allTopics = self.status.mailservers.getMailserverTopicsByChatId(self.activeChannel.id).map(topic => topic.topic)
|
||||
|
||||
let currentOldestMessageTimestamp = self.oldestMessageTimestamp
|
||||
self.oldestMessageTimestamp = self.oldestMessageTimestamp - fetchRange
|
||||
|
||||
self.status.mailservers.requestMessages(allTopics, self.oldestMessageTimestamp, currentOldestMessageTimestamp, true)
|
||||
self.oldestMessageTimestampChanged()
|
||||
self.messagesLoaded();
|
||||
|
||||
proc requestMoreMessages*(self: ChatsView, fetchRange: int) {.slot.} =
|
||||
self.loadingMessages = true
|
||||
self.loadingMessagesChanged(true)
|
||||
let topics = self.status.mailservers.getMailserverTopicsByChatId(self.activeChannel.id).map(topic => topic.topic)
|
||||
let currentOldestMessageTimestamp = self.oldestMessageTimestamp
|
||||
self.oldestMessageTimestamp = self.oldestMessageTimestamp - fetchRange
|
||||
|
||||
self.status.mailservers.requestMessages(topics, self.oldestMessageTimestamp, currentOldestMessageTimestamp, true)
|
||||
self.oldestMessageTimestampChanged()
|
||||
self.messagesLoaded();
|
||||
|
||||
proc leaveChatByIndex*(self: ChatsView, channelIndex: int) {.slot.} =
|
||||
|
@ -152,12 +152,7 @@ Item {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if(chatsModel.activeChannel.isTimelineChat){
|
||||
chatsModel.requestMoreTimelineMessages(Constants.fetchRangeLast24Hours);
|
||||
} else {
|
||||
chatsModel.requestMoreMessages(Constants.fetchRangeLast24Hours);
|
||||
}
|
||||
|
||||
chatsModel.requestMoreMessages(Constants.fetchRangeLast24Hours);
|
||||
timer.setTimeout(function(){
|
||||
chatsModel.hideLoadingIndicator()
|
||||
}, 3000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user