fix: delete mailserver topic on leaving channel
This commit is contained in:
parent
6bd8aa9504
commit
358f647735
|
@ -109,7 +109,7 @@ QtObject:
|
||||||
read = getOldestMessageTimestamp
|
read = getOldestMessageTimestamp
|
||||||
notify = oldestMessageTimestampChanged
|
notify = oldestMessageTimestampChanged
|
||||||
|
|
||||||
proc setLastMessageTimestamp(self: ChatsView, force = false) =
|
proc setLastMessageTimestamp*(self: ChatsView, force = false) =
|
||||||
if self.status.chat.lastMessageTimestamps.hasKey(self.activeChannel.id):
|
if self.status.chat.lastMessageTimestamps.hasKey(self.activeChannel.id):
|
||||||
if force or self.status.chat.lastMessageTimestamps[self.activeChannel.id] <= self.oldestMessageTimestamp:
|
if force or self.status.chat.lastMessageTimestamps[self.activeChannel.id] <= self.oldestMessageTimestamp:
|
||||||
self.oldestMessageTimestamp = self.status.chat.lastMessageTimestamps[self.activeChannel.id]
|
self.oldestMessageTimestamp = self.status.chat.lastMessageTimestamps[self.activeChannel.id]
|
||||||
|
@ -539,9 +539,11 @@ QtObject:
|
||||||
let selectedChannel = self.chats.getChannel(channelIndex)
|
let selectedChannel = self.chats.getChannel(channelIndex)
|
||||||
if (selectedChannel == nil): return
|
if (selectedChannel == nil): return
|
||||||
self.status.chat.leave(selectedChannel.id)
|
self.status.chat.leave(selectedChannel.id)
|
||||||
|
self.status.mailservers.deleteMailserverTopic(selectedChannel.id)
|
||||||
|
|
||||||
proc leaveActiveChat*(self: ChatsView) {.slot.} =
|
proc leaveActiveChat*(self: ChatsView) {.slot.} =
|
||||||
self.status.chat.leave(self.activeChannel.id)
|
self.status.chat.leave(self.activeChannel.id)
|
||||||
|
self.status.mailservers.deleteMailserverTopic(self.activeChannel.id)
|
||||||
|
|
||||||
proc removeChat*(self: ChatsView, chatId: string) =
|
proc removeChat*(self: ChatsView, chatId: string) =
|
||||||
discard self.chats.removeChatItemFromList(chatId)
|
discard self.chats.removeChatItemFromList(chatId)
|
||||||
|
|
|
@ -56,3 +56,6 @@ proc addMailserverTopic*(topic: MailserverTopic): string =
|
||||||
"chat-ids": topic.chatIds,
|
"chat-ids": topic.chatIds,
|
||||||
"last-request": topic.lastRequest
|
"last-request": topic.lastRequest
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
proc deleteMailserverTopic*(topic: string): string =
|
||||||
|
return callPrivateRPC("mailservers_deleteMailserverTopic", %*[topic])
|
||||||
|
|
|
@ -207,6 +207,12 @@ proc getMailserverTopicsByChatId*(self: MailserverModel, chatId: string): seq[Ma
|
||||||
proc addMailserverTopic*(self: MailserverModel, topic: MailserverTopic) =
|
proc addMailserverTopic*(self: MailserverModel, topic: MailserverTopic) =
|
||||||
discard status_mailservers.addMailserverTopic(topic)
|
discard status_mailservers.addMailserverTopic(topic)
|
||||||
|
|
||||||
|
proc deleteMailserverTopic*(self: MailserverModel, chatId: string) =
|
||||||
|
var topic:MailserverTopic = self.getMailserverTopicsByChatId(chatId)[0]
|
||||||
|
if(topic.chatIds.len > 1):
|
||||||
|
discard status_mailservers.addMailserverTopic(topic)
|
||||||
|
else:
|
||||||
|
discard status_mailservers.deleteMailserverTopic(topic.topic)
|
||||||
|
|
||||||
proc findNewMailserver(self: MailserverModel) =
|
proc findNewMailserver(self: MailserverModel) =
|
||||||
warn "Finding a new mailserver..."
|
warn "Finding a new mailserver..."
|
||||||
|
|
Loading…
Reference in New Issue