mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 11:23:00 +08:00
Merge pull request #16109 from smoogipoo/chat-overlay-multiplayer-removal
Don't show multiplayer channels in chat overlay
This commit is contained in:
commit
aa0813ff05
@ -393,6 +393,25 @@ namespace osu.Game.Tests.Visual.Online
|
||||
channelManager.CurrentChannel.Value.Type == ChannelType.PM && channelManager.CurrentChannel.Value.Users.Single().Username == "some body");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMultiplayerChannelIsNotShown()
|
||||
{
|
||||
Channel multiplayerChannel = null;
|
||||
|
||||
AddStep("join multiplayer channel", () => channelManager.JoinChannel(multiplayerChannel = new Channel(new APIUser())
|
||||
{
|
||||
Name = "#mp_1",
|
||||
Type = ChannelType.Multiplayer,
|
||||
}));
|
||||
|
||||
AddAssert("channel joined", () => channelManager.JoinedChannels.Contains(multiplayerChannel));
|
||||
AddAssert("channel not present in overlay", () => !chatOverlay.TabMap.ContainsKey(multiplayerChannel));
|
||||
AddAssert("multiplayer channel is not current", () => channelManager.CurrentChannel.Value != multiplayerChannel);
|
||||
|
||||
AddStep("leave channel", () => channelManager.LeaveChannel(multiplayerChannel));
|
||||
AddAssert("channel left", () => !channelManager.JoinedChannels.Contains(multiplayerChannel));
|
||||
}
|
||||
|
||||
private void pressChannelHotkey(int number)
|
||||
{
|
||||
var channelKey = Key.Number0 + number;
|
||||
|
@ -237,10 +237,7 @@ namespace osu.Game.Overlays
|
||||
Schedule(() =>
|
||||
{
|
||||
// TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
|
||||
channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;
|
||||
|
||||
foreach (Channel channel in channelManager.JoinedChannels)
|
||||
ChannelTabControl.AddChannel(channel);
|
||||
channelManager.JoinedChannels.BindCollectionChanged(joinedChannelsChanged, true);
|
||||
|
||||
channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
|
||||
availableChannelsChanged(null, null);
|
||||
@ -436,12 +433,19 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
foreach (Channel channel in args.NewItems.Cast<Channel>())
|
||||
ChannelTabControl.AddChannel(channel);
|
||||
{
|
||||
if (channel.Type != ChannelType.Multiplayer)
|
||||
ChannelTabControl.AddChannel(channel);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
foreach (Channel channel in args.OldItems.Cast<Channel>())
|
||||
{
|
||||
if (!ChannelTabControl.Items.Contains(channel))
|
||||
continue;
|
||||
|
||||
ChannelTabControl.RemoveChannel(channel);
|
||||
|
||||
var loaded = loadedChannels.Find(c => c.Channel == channel);
|
||||
|
Loading…
Reference in New Issue
Block a user