mirror of
https://github.com/ppy/osu
synced 2025-02-01 02:41:52 +00:00
Ensure two day separators are not added in a row
This commit is contained in:
parent
fa7b45dfb1
commit
e53b4321ff
@ -191,7 +191,15 @@ namespace osu.Game.Overlays.Chat
|
||||
private void addDaySeparatorIfRequired(Message lastMessage, Message message)
|
||||
{
|
||||
if (lastMessage == null || lastMessage.Timestamp.ToLocalTime().Date != message.Timestamp.ToLocalTime().Date)
|
||||
{
|
||||
// A day separator is displayed even if no messages are in the channel.
|
||||
// If there are no messages after it, the simplest way to ensure it is fresh is to remove it
|
||||
// and add a new one instead.
|
||||
if (ChatLineFlow.LastOrDefault() is DaySeparator ds)
|
||||
ChatLineFlow.Remove(ds, true);
|
||||
|
||||
ChatLineFlow.Add(CreateDaySeparator(message.Timestamp));
|
||||
}
|
||||
}
|
||||
|
||||
private void messageRemoved(Message removed) => Schedule(() =>
|
||||
|
Loading…
Reference in New Issue
Block a user