diff --git a/src/Tgstation.Server.Host/Components/Chat/ChannelMapping.cs b/src/Tgstation.Server.Host/Components/Chat/ChannelMapping.cs
index 8773e402a9..19581b09bb 100644
--- a/src/Tgstation.Server.Host/Components/Chat/ChannelMapping.cs
+++ b/src/Tgstation.Server.Host/Components/Chat/ChannelMapping.cs
@@ -1,4 +1,4 @@
-#nullable disable
+using System;
namespace Tgstation.Server.Host.Components.Chat
{
@@ -40,6 +40,15 @@ namespace Tgstation.Server.Host.Components.Chat
///
/// The with the mapped Id.
///
- public ChannelRepresentation Channel { get; set; }
+ public ChannelRepresentation Channel { get; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The value of .
+ public ChannelMapping(ChannelRepresentation channel)
+ {
+ Channel = channel ?? throw new ArgumentNullException(nameof(channel));
+ }
}
}
diff --git a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs
index 409c6555c2..44e6625691 100644
--- a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs
+++ b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs
@@ -71,7 +71,7 @@ namespace Tgstation.Server.Host.Components.Chat
readonly Dictionary providers;
///
- /// Map of s used to guard concurrent access to , keyed by .
+ /// Map of s used to guard concurrent access to , keyed by .
///
readonly ConcurrentDictionary changeChannelSemaphores;
@@ -236,7 +236,7 @@ namespace Tgstation.Server.Host.Components.Chat
var newMappings = results.SelectMany(
kvp => kvp.Value.Select(
- channelRepresentation => new ChannelMapping
+ channelRepresentation => new ChannelMapping(channelRepresentation)
{
IsWatchdogChannel = kvp.Key.IsWatchdogChannel == true,
IsUpdatesChannel = kvp.Key.IsUpdatesChannel == true,
@@ -244,7 +244,6 @@ namespace Tgstation.Server.Host.Components.Chat
IsSystemChannel = kvp.Key.IsSystemChannel == true,
ProviderChannelId = channelRepresentation.RealId,
ProviderId = connectionId,
- Channel = channelRepresentation,
}));
ulong baseId;
@@ -767,11 +766,10 @@ namespace Tgstation.Server.Host.Components.Chat
message.User.Channel.ConnectionName,
message.User.FriendlyName,
newId);
- mappedChannels.Add(newId, new ChannelMapping
+ mappedChannels.Add(newId, new ChannelMapping(message.User.Channel)
{
ProviderChannelId = message.User.Channel.RealId,
ProviderId = providerId,
- Channel = message.User.Channel,
});
logger.LogTrace(