This commit is contained in:
mmrbnjd
2025-08-08 23:59:03 +03:30
parent 1df87f08e8
commit 278bf2f601
2 changed files with 13 additions and 0 deletions

View File

@@ -212,6 +212,8 @@ namespace Hushian.Application.Services
}).FirstOrDefaultAsync(); }).FirstOrDefaultAsync();
Response.Success = mi.ID > 0; Response.Success = mi.ID > 0;
if (Response.Success)
await NewChatInHub(dto.CompanyID);
} }
else Response.Errors.Add("شناسه گروه صحیح نمی باشد"); else Response.Errors.Add("شناسه گروه صحیح نمی باشد");
@@ -508,6 +510,11 @@ namespace Hushian.Application.Services
await _hubContext.Clients.User(UserID.ToString()) await _hubContext.Clients.User(UserID.ToString())
.SendAsync("CheckMarkAsRead", item); .SendAsync("CheckMarkAsRead", item);
} }
public async Task NewChatInHub(int CompanyID)
{
await _hubContext.Clients.All
.SendAsync("NewChat", CompanyID);
}
} }
} }

View File

@@ -338,6 +338,12 @@
{ ChatCurrent.Responses.First(a => a.ID == chatresponseid).IsRead = true; StateHasChanged(); } { ChatCurrent.Responses.First(a => a.ID == chatresponseid).IsRead = true; StateHasChanged(); }
}); });
//NewChat
hubConnection.On<int>("NewChat", async (companyid) =>
{
if (CurrentUser.CompanyID==companyid)
{ Inbox1Items = await chatService.ChatAwaitingOurResponse(); StateHasChanged(); }
});
await hubConnection.StartAsync(); await hubConnection.StartAsync();
//---------end hub //---------end hub