1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 00:43:21 +08:00

Merge pull request #18913 from peppy/chat-channel-logging

Add logging around current channel changes and join requests
This commit is contained in:
Dan Balasescu 2022-06-28 14:46:57 +09:00 committed by GitHub
commit 2f264aaf0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 6 deletions

View File

@ -472,8 +472,8 @@ namespace osu.Game.Tests.Visual.Online
});
AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1)));
waitForChannel1Visible();
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
waitForChannel2Visible();

View File

@ -133,12 +133,14 @@ namespace osu.Game.Online.Chat
?? JoinChannel(new Channel(user));
}
private void currentChannelChanged(ValueChangedEvent<Channel> e)
private void currentChannelChanged(ValueChangedEvent<Channel> channel)
{
bool isSelectorChannel = e.NewValue is ChannelListing.ChannelListingChannel;
bool isSelectorChannel = channel.NewValue is ChannelListing.ChannelListingChannel;
if (!isSelectorChannel)
JoinChannel(e.NewValue);
JoinChannel(channel.NewValue);
Logger.Log($"Current channel changed to {channel.NewValue}");
}
/// <summary>
@ -447,9 +449,17 @@ namespace osu.Game.Online.Chat
return channel;
case ChannelType.PM:
Logger.Log($"Attempting to join PM channel {channel}");
var createRequest = new CreateChannelRequest(channel);
createRequest.Failure += e =>
{
Logger.Log($"Failed to join PM channel {channel} ({e.Message})");
};
createRequest.Success += resChannel =>
{
Logger.Log($"Joined PM channel {channel} ({resChannel.ChannelID})");
if (resChannel.ChannelID.HasValue)
{
channel.Id = resChannel.ChannelID.Value;
@ -463,9 +473,19 @@ namespace osu.Game.Online.Chat
break;
default:
Logger.Log($"Attempting to join public channel {channel}");
var req = new JoinChannelRequest(channel);
req.Success += () => joinChannel(channel, fetchInitialMessages);
req.Failure += _ => LeaveChannel(channel);
req.Success += () =>
{
Logger.Log($"Joined public channel {channel}");
joinChannel(channel, fetchInitialMessages);
};
req.Failure += e =>
{
Logger.Log($"Failed to join public channel {channel} ({e.Message})");
LeaveChannel(channel);
};
api.Queue(req);
return channel;
}