mirror of
https://github.com/osukey/osukey.git
synced 2025-07-17 00:10:04 +09:00
Change method parameters, add detailed error message and method docs
This commit is contained in:
@ -445,12 +445,22 @@ namespace osu.Game.Online.Chat
|
|||||||
return tcs.Task;
|
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);
|
var req = new MarkChannelAsReadRequest(channel, message);
|
||||||
|
|
||||||
req.Success += () => channel.LastReadId = message.Id;
|
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);
|
api.Queue(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
// mark channel as read when channel switched
|
// mark channel as read when channel switched
|
||||||
if (e.NewValue.Messages.Any())
|
if (e.NewValue.Messages.Any())
|
||||||
channelManager.MarkChannelAsRead(e.NewValue.Messages.Last());
|
channelManager.MarkChannelAsRead(e.NewValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float startDragChatHeight;
|
private float startDragChatHeight;
|
||||||
|
Reference in New Issue
Block a user