set default colors

This commit is contained in:
Ryan Peters 2021-07-22 22:51:14 -04:00
parent 4cda805f85
commit 4a67c41bf1

View File

@ -18,6 +18,7 @@ namespace BinaryDad.Coding.Hubs
Users.Sessions[Context.ConnectionId].Css = code; Users.Sessions[Context.ConnectionId].Css = code;
} }
// only send to all if it's a teacher
if (isTeacher) if (isTeacher)
{ {
return Clients.All.SendAsync("ReceiveCode", user, index, code); return Clients.All.SendAsync("ReceiveCode", user, index, code);
@ -30,7 +31,7 @@ namespace BinaryDad.Coding.Hubs
{ {
Users.Sessions[Context.ConnectionId].Id = Context.ConnectionId; Users.Sessions[Context.ConnectionId].Id = Context.ConnectionId;
Users.Sessions[Context.ConnectionId].Name = name; Users.Sessions[Context.ConnectionId].Name = name;
Users.Sessions[Context.ConnectionId].Color = color; Users.Sessions[Context.ConnectionId].Color = string.IsNullOrWhiteSpace(color) ? "white" : color;
await Clients.All.SendAsync("UsersList", Users.Sessions); await Clients.All.SendAsync("UsersList", Users.Sessions);
} }
@ -39,7 +40,7 @@ namespace BinaryDad.Coding.Hubs
{ {
Users.Sessions[Context.ConnectionId] = new User Users.Sessions[Context.ConnectionId] = new User
{ {
Name = "" Name = string.Empty
}; };
await Clients.All.SendAsync("UsersList", Users.Sessions); await Clients.All.SendAsync("UsersList", Users.Sessions);