fix: chat view shown after community creation

Fixes: #2686.

Previously, when using a new account, joining a chat then creating a community and then returning back to the chat would not show a chat at all and instead show the default chat view. This was due to the previous index not being set when there were no other channels in the chat.

This has been updated such that the previous channel index is set when switching from chat to community and no previous channel index has been set.

# Conflicts:
#	src/app/chat/view.nim
This commit is contained in:
Eric Mastro 2021-06-17 13:32:02 +10:00 committed by Iuri Matias
parent ef7ac11f06
commit 4c0371144b
1 changed files with 2 additions and 0 deletions

View File

@ -124,6 +124,8 @@ QtObject:
self.status.chat.setActiveChannel(selectedChannel.id)
proc setActiveChannelByIndex*(self: ChannelView, index: int) {.slot.} =
if self.previousActiveChannelIndex == -1 and self.chats.rowCount() > -1:
self.previousActiveChannelIndex = 0
self.setActiveChannelByIndexWithForce(index, false)
proc getActiveChannelIdx(self: ChannelView): int {.slot.} =