mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 04:13:11 +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)));
|
AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1)));
|
||||||
|
|
||||||
waitForChannel1Visible();
|
waitForChannel1Visible();
|
||||||
|
|
||||||
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
|
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
|
||||||
waitForChannel2Visible();
|
waitForChannel2Visible();
|
||||||
|
|
||||||
|
@ -133,12 +133,14 @@ namespace osu.Game.Online.Chat
|
|||||||
?? JoinChannel(new Channel(user));
|
?? 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)
|
if (!isSelectorChannel)
|
||||||
JoinChannel(e.NewValue);
|
JoinChannel(channel.NewValue);
|
||||||
|
|
||||||
|
Logger.Log($"Current channel changed to {channel.NewValue}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -447,9 +449,17 @@ namespace osu.Game.Online.Chat
|
|||||||
return channel;
|
return channel;
|
||||||
|
|
||||||
case ChannelType.PM:
|
case ChannelType.PM:
|
||||||
|
Logger.Log($"Attempting to join PM channel {channel}");
|
||||||
|
|
||||||
var createRequest = new CreateChannelRequest(channel);
|
var createRequest = new CreateChannelRequest(channel);
|
||||||
|
createRequest.Failure += e =>
|
||||||
|
{
|
||||||
|
Logger.Log($"Failed to join PM channel {channel} ({e.Message})");
|
||||||
|
};
|
||||||
createRequest.Success += resChannel =>
|
createRequest.Success += resChannel =>
|
||||||
{
|
{
|
||||||
|
Logger.Log($"Joined PM channel {channel} ({resChannel.ChannelID})");
|
||||||
|
|
||||||
if (resChannel.ChannelID.HasValue)
|
if (resChannel.ChannelID.HasValue)
|
||||||
{
|
{
|
||||||
channel.Id = resChannel.ChannelID.Value;
|
channel.Id = resChannel.ChannelID.Value;
|
||||||
@ -463,9 +473,19 @@ namespace osu.Game.Online.Chat
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Logger.Log($"Attempting to join public channel {channel}");
|
||||||
|
|
||||||
var req = new JoinChannelRequest(channel);
|
var req = new JoinChannelRequest(channel);
|
||||||
req.Success += () => joinChannel(channel, fetchInitialMessages);
|
req.Success += () =>
|
||||||
req.Failure += _ => LeaveChannel(channel);
|
{
|
||||||
|
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);
|
api.Queue(req);
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user