Spaces:
Running
Running
User
Fix: Notification, Remove toggle, add kanban board to menu, fix project ID to project name
64a3c1d | using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.AspNetCore.SignalR; | |
| using TaskTrackingSystem.WebApi.Infrastructure; | |
| namespace TaskTrackingSystem.WebApi.Features.Notification; | |
| [] | |
| public class NotificationHub : Hub | |
| { | |
| public static string GetUserGroupName(long userId) => $"notification-user-{userId}"; | |
| public override async global::System.Threading.Tasks.Task OnConnectedAsync() | |
| { | |
| var userId = Context.User?.GetUserId() ?? 0; | |
| if (userId > 0) | |
| { | |
| await Groups.AddToGroupAsync(Context.ConnectionId, GetUserGroupName(userId)); | |
| } | |
| await base.OnConnectedAsync(); | |
| } | |
| public override async global::System.Threading.Tasks.Task OnDisconnectedAsync(Exception? exception) | |
| { | |
| var userId = Context.User?.GetUserId() ?? 0; | |
| if (userId > 0) | |
| { | |
| await Groups.RemoveFromGroupAsync(Context.ConnectionId, GetUserGroupName(userId)); | |
| } | |
| await base.OnDisconnectedAsync(exception); | |
| } | |
| } | |