Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ namespace BotSharp.Abstraction.Repositories.Filters;

public class RoleFilter
{
[JsonPropertyName("names")]
public IEnumerable<string>? Names { get; set; }

[JsonPropertyName("exclude_roles")]
public IEnumerable<string>? ExcludeRoles { get; set; } = UserConstant.AdminRoles;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public async Task<IEnumerable<string>> GetRoleOptions()
}

[BotSharpAuth]
[HttpPost("/roles")]
public async Task<IEnumerable<RoleViewModel>> GetRoles([FromBody] RoleFilter? filter = null)
[HttpGet("/roles")]
public async Task<IEnumerable<RoleViewModel>> GetRoles([FromQuery] RoleFilter? filter = null)
{
if (filter == null)
{
Expand Down
12 changes: 7 additions & 5 deletions src/Plugins/BotSharp.Plugin.ChatHub/SignalRHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class SignalRHub : Hub
private readonly IUserIdentity _user;
private readonly IHttpContextAccessor _context;

public SignalRHub(IServiceProvider services,
public SignalRHub(
IServiceProvider services,
ILogger<SignalRHub> logger,
IUserIdentity user,
IHttpContextAccessor context)
Expand All @@ -25,15 +26,16 @@ public SignalRHub(IServiceProvider services,

public override async Task OnConnectedAsync()
{
_logger.LogInformation($"SignalR Hub: {_user.FirstName} {_user.LastName} ({Context.User.Identity.Name}) connected in {Context.ConnectionId}");

var convService = _services.GetRequiredService<IConversationService>();
var httpContext = Context.GetHttpContext();
var httpContext = Context?.GetHttpContext();

_logger.LogInformation($"SignalR Hub: {_user?.FirstName} {_user?.LastName} ({Context?.User?.Identity?.Name ?? "Unkown user"}) connected in {Context?.ConnectionId}");

string? conversationId = httpContext?.Request?.Query["conversation-id"].FirstOrDefault();

if (!string.IsNullOrEmpty(conversationId))
{
_logger.LogInformation($"Connection {Context.ConnectionId} is with conversation {conversationId}");
_logger.LogInformation($"Connection {Context?.ConnectionId} is with conversation {conversationId}");
await AddGroup(conversationId);

var conv = await convService.GetConversation(conversationId);
Expand Down
Loading