diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs
index 47e45e67d1..1404c0f333 100644
--- a/osu.Game/Online/Chat/ChannelManager.cs
+++ b/osu.Game/Online/Chat/ChannelManager.cs
@@ -420,10 +420,11 @@ namespace osu.Game.Online.Chat
/// Joins a channel if it has not already been joined. Must be called from the update thread.
///
/// The channel to join.
+ /// Switch to the joined channel on successful request.
/// The joined channel. Note that this may not match the parameter channel as it is a backed object.
- public Channel JoinChannel(Channel channel) => joinChannel(channel, true);
+ public Channel JoinChannel(Channel channel, bool switchToJoined = false) => joinChannel(channel, switchToJoined, true);
- private Channel joinChannel(Channel channel, bool fetchInitialMessages = false)
+ private Channel joinChannel(Channel channel, bool switchToJoined = false, bool fetchInitialMessages = false)
{
if (channel == null) return null;
@@ -439,7 +440,7 @@ namespace osu.Game.Online.Chat
case ChannelType.Multiplayer:
// join is implicit. happens when you join a multiplayer game.
// this will probably change in the future.
- joinChannel(channel, fetchInitialMessages);
+ joinChannel(channel, switchToJoined, fetchInitialMessages);
return channel;
case ChannelType.PM:
@@ -460,7 +461,7 @@ namespace osu.Game.Online.Chat
default:
var req = new JoinChannelRequest(channel);
- req.Success += () => joinChannel(channel, fetchInitialMessages);
+ req.Success += () => joinChannel(channel, switchToJoined, fetchInitialMessages);
req.Failure += ex => LeaveChannel(channel);
api.Queue(req);
return channel;
@@ -472,7 +473,8 @@ namespace osu.Game.Online.Chat
this.fetchInitialMessages(channel);
}
- CurrentChannel.Value ??= channel;
+ if (switchToJoined || CurrentChannel.Value == null)
+ CurrentChannel.Value = channel;
return channel;
}