From 088c180873172d1848d7ad29721b9be27ded0c05 Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Sat, 2 May 2020 21:10:43 -0700 Subject: [PATCH] Add display name to chat messages. --- Server/Services/BrowserHub.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Server/Services/BrowserHub.cs b/Server/Services/BrowserHub.cs index 10287537d..eba523e6f 100644 --- a/Server/Services/BrowserHub.cs +++ b/Server/Services/BrowserHub.cs @@ -49,7 +49,10 @@ public Task Chat(string message, string[] deviceIDs) deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser); var connections = GetActiveClientConnections(deviceIDs); var organizationName = DataService.GetOrganizationName(RemotelyUser.UserName); - return DeviceHubContext.Clients.Clients(connections.Select(x => x.Key).ToList()).SendAsync("Chat", $"{RemotelyUser.UserName}: {message}", organizationName, Context.ConnectionId); + return DeviceHubContext.Clients.Clients(connections.Select(x => x.Key).ToList()).SendAsync("Chat", + $"{RemotelyUser.DisplayName ?? RemotelyUser.UserName}: {message}", + organizationName, + Context.ConnectionId); } public Task DeployScript(string fileID, string mode, string[] deviceIDs)