Media Controller Tests and other

This commit is contained in:
Artemy
2025-07-21 16:18:04 +07:00
parent c0d02e0fa1
commit c434ca447c
8 changed files with 286 additions and 22 deletions
+3 -4
View File
@@ -33,11 +33,10 @@ public class FriendsHub : Hub
if (userId == Guid.Empty)
{
_logger.LogWarning("User connected with invalid UserID claim.");
Context.Abort(); // Abort connection if userID is invalid
Context.Abort();
return;
}
// Add user to their own group (for private messages and notifications)
await Groups.AddToGroupAsync(Context.ConnectionId, userId.ToString());
_logger.LogInformation("User {UserId} connected with ConnectionId {ConnectionId} and added to their group",
userId, Context.ConnectionId);
@@ -48,7 +47,7 @@ public class FriendsHub : Hub
public override async Task OnDisconnectedAsync(Exception? exception)
{
var userId =
GetUserId(suppressException: true); // Suppress exception if userID is not found (e.g. connection aborted early)
GetUserId(suppressException: true);
if (userId != Guid.Empty)
{
// Remove user from their own group