Update `ChannelManager.CurrentChannel` directly to handle non-loaded chat scenario

`currentChannel` gets instantiated once the chat overlay is open, while
`HighlightMessage` could be called while the chat overlay has never been
open.

This will all be rewritten with the new chat overlay design anyways, so
should be fine for now.
This commit is contained in:
Salman Ahmed 2022-03-08 03:42:17 +03:00
parent f8e5570e41
commit f645869958
1 changed files with 3 additions and 3 deletions

View File

@ -309,10 +309,10 @@ private void currentChannelChanged(ValueChangedEvent<Channel> e)
/// <param name="message">The message to highlight.</param>
public void HighlightMessage(Message message)
{
if (currentChannel.Value.Id != message.ChannelId)
currentChannel.Value = channelManager.JoinedChannels.Single(c => c.Id == message.ChannelId);
if (channelManager.CurrentChannel.Value.Id != message.ChannelId)
channelManager.CurrentChannel.Value = channelManager.JoinedChannels.Single(c => c.Id == message.ChannelId);
currentChannel.Value.HighlightedMessage.Value = message;
channelManager.CurrentChannel.Value.HighlightedMessage.Value = message;
}
private float startDragChatHeight;