Skip to content

Commit cd131ce

Browse files
committed
* Forcefully refresh channel list if user isn't in any servers.
Fixes #220.
1 parent 0ec4efd commit cd131ce

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/core/DiscordInstance.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2493,12 +2493,17 @@ void DiscordInstance::HandleREADY(Json& j)
24932493
// select the first guild, if possible
24942494
Snowflake guildsf = 0;
24952495

2496+
bool forceRefresh = false;
24962497
if (firstReadyOnThisUser) {
24972498
m_CurrentChannel = 0;
24982499

24992500
auto list = m_guildItemList.GetItems();
2500-
if (list->size() > 0)
2501+
if (list->size() > 0) {
25012502
guildsf = list->front()->GetID();
2503+
}
2504+
else {
2505+
forceRefresh = true;
2506+
}
25022507
}
25032508
else {
25042509
guildsf = m_CurrentGuild;
@@ -2507,6 +2512,9 @@ void DiscordInstance::HandleREADY(Json& j)
25072512
GetFrontend()->RepaintGuildList();
25082513
OnSelectGuild(guildsf);
25092514

2515+
if (forceRefresh)
2516+
GetFrontend()->UpdateSelectedGuild();
2517+
25102518
// Doing this because the contents of all channels might be outdated.
25112519
GetMessageCache()->ClearAllChannels();
25122520
GetFrontend()->UpdateSelectedChannel();

0 commit comments

Comments
 (0)