mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
Add constructor to create a PM channel from a User
This commit is contained in:
parent
2122966cd4
commit
2f9de149dd
@ -88,6 +88,17 @@ namespace osu.Game.Online.Chat
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a private messaging channel with the specified user.
|
||||
/// </summary>
|
||||
/// <param name="user">The user to create the private conversation with.</param>
|
||||
public Channel(User user)
|
||||
{
|
||||
Type = ChannelType.PM;
|
||||
Users.Add(user);
|
||||
Name = user.Username;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the argument message as a local echo. When this local echo is resolved <see cref="PendingMessageResolved"/> will get called.
|
||||
/// </summary>
|
||||
|
@ -79,7 +79,7 @@ namespace osu.Game.Online.Chat
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
|
||||
CurrentChannel.Value = JoinedChannels.FirstOrDefault(c => c.Type == ChannelType.PM && c.Users.Count == 1 && c.Users.Any(u => u.Id == user.Id))
|
||||
?? new Channel { Name = user.Username, Users = { user }, Type = ChannelType.PM };
|
||||
?? new Channel(user);
|
||||
}
|
||||
|
||||
private void currentChannelChanged(Channel channel) => JoinChannel(channel);
|
||||
|
Loading…
Reference in New Issue
Block a user