diff --git a/dotnet/AipsRT/Model/Whiteboard/Whiteboard.cs b/dotnet/AipsRT/Model/Whiteboard/Whiteboard.cs index 87a728e..fa8bc5f 100644 --- a/dotnet/AipsRT/Model/Whiteboard/Whiteboard.cs +++ b/dotnet/AipsRT/Model/Whiteboard/Whiteboard.cs @@ -14,8 +14,7 @@ public class Whiteboard public List ActiveUsers { get; } = []; public void AddActiveUser(User user) => ActiveUsers.Add(user); - public void RemoveActiveUser(Guid userId) - => ActiveUsers.RemoveAll(u => u.UserId == userId); + public void RemoveActiveUser(Guid userId) => ActiveUsers.RemoveAll(u => u.UserId == userId); public List Shapes { get; } = []; @@ -48,5 +47,11 @@ public class Whiteboard TextShapes.Add(shape); } - public void AddUser(User user) => Users.Add(user); + public void AddUser(User user) + { + if (!Users.Contains(user)) + { + Users.Add(user); + } + } } \ No newline at end of file diff --git a/dotnet/AipsRT/Services/RtErrorHandleStrategy.cs b/dotnet/AipsRT/Services/RtErrorHandleStrategy.cs index 3f14796..2669f2f 100644 --- a/dotnet/AipsRT/Services/RtErrorHandleStrategy.cs +++ b/dotnet/AipsRT/Services/RtErrorHandleStrategy.cs @@ -18,9 +18,16 @@ public class RtErrorHandleStrategy : IErrorMessageHandleStrategy public async Task Handle(ErrorMessage message, CancellationToken cancellationToken) { + var activeUsers = _whiteboardManager.GetWhiteboard(message.WhiteboardId)!.ActiveUsers; + await _whiteboardManager.LoadWhiteboard(message.WhiteboardId); var whiteboard = _whiteboardManager.GetWhiteboard(message.WhiteboardId)!; + + foreach (var user in activeUsers) + { + whiteboard.AddActiveUser(user); + } await _hubContext.Clients .Group(whiteboard.WhiteboardId.ToString())