mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +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:
commit
2f264aaf0a
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user