mirror of
https://github.com/ppy/osu
synced 2025-02-18 11:26:57 +00:00
Change method parameters, add detailed error message and method docs
This commit is contained in:
parent
cd679707ed
commit
50e357a799
@ -445,12 +445,22 @@ namespace osu.Game.Online.Chat
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
public void MarkChannelAsRead(Message message)
|
||||
/// <summary>
|
||||
/// Marks the <paramref name="channel"/> as read
|
||||
/// <see>(see <paramref name="message"/> for more information)</see>
|
||||
/// </summary>
|
||||
/// <param name="channel">The channel that will be marked as read</param>
|
||||
/// <param name="message">The message where it will be read up to. If <see langword="null"/> was provided, the latest message of the <paramref name="channel"/> will be read.</param>
|
||||
public void MarkChannelAsRead(Channel channel, Message message = null)
|
||||
{
|
||||
var channel = JoinedChannels.Single(c => c.Id == message.ChannelId);
|
||||
if (message == null)
|
||||
message = channel.Messages.Last();
|
||||
|
||||
var req = new MarkChannelAsReadRequest(channel, message);
|
||||
|
||||
req.Success += () => channel.LastReadId = message.Id;
|
||||
req.Failure += e => Logger.Error(e, "Failed to mark channel as read");
|
||||
req.Failure += e => Logger.Error(e, $"Failed to mark channel {channel.ToString()} up to '{message.ToString()}' as read");
|
||||
|
||||
api.Queue(req);
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
// mark channel as read when channel switched
|
||||
if (e.NewValue.Messages.Any())
|
||||
channelManager.MarkChannelAsRead(e.NewValue.Messages.Last());
|
||||
channelManager.MarkChannelAsRead(e.NewValue);
|
||||
}
|
||||
|
||||
private float startDragChatHeight;
|
||||
|
Loading…
Reference in New Issue
Block a user