Change filter method to consider all non-system channels as joinable

This commit is contained in:
Dean Herbert 2022-05-25 18:42:33 +09:00
parent f6810d3f59
commit a92089c443

View File

@ -342,7 +342,7 @@ namespace osu.Game.Overlays
switch (args.Action) switch (args.Action)
{ {
case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Add:
IEnumerable<Channel> newChannels = filterChannels(args.NewItems); IEnumerable<Channel> newChannels = filterToChatChannels(args.NewItems);
foreach (var channel in newChannels) foreach (var channel in newChannels)
channelList.AddChannel(channel); channelList.AddChannel(channel);
@ -350,7 +350,7 @@ namespace osu.Game.Overlays
break; break;
case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Remove:
IEnumerable<Channel> leftChannels = filterChannels(args.OldItems); IEnumerable<Channel> leftChannels = filterToChatChannels(args.OldItems);
foreach (var channel in leftChannels) foreach (var channel in leftChannels)
{ {
@ -372,8 +372,6 @@ namespace osu.Game.Overlays
private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
=> channelListing.UpdateAvailableChannels(channelManager.AvailableChannels); => channelListing.UpdateAvailableChannels(channelManager.AvailableChannels);
private IEnumerable<Channel> filterChannels(IEnumerable channels)
=> channels.Cast<Channel>().Where(c => c.Type == ChannelType.Public || c.Type == ChannelType.PM);
private void handleChatMessage(string message) private void handleChatMessage(string message)
{ {
@ -402,5 +400,7 @@ namespace osu.Game.Overlays
currentChannel.Value = overlayChannels[nextIdx]; currentChannel.Value = overlayChannels[nextIdx];
} }
private IEnumerable<Channel> filterToChatChannels(IEnumerable channels) => channels.Cast<Channel>().Where(c => c.Type != ChannelType.System);
} }
} }