Don't require user when getting current session

This commit is contained in:
Cody Robibero 2024-05-19 08:25:38 -06:00
parent 76854b5eff
commit b19b346670

View File

@ -120,7 +120,12 @@ public static class RequestHelpers
internal static async Task<SessionInfo> GetSession(ISessionManager sessionManager, IUserManager userManager, HttpContext httpContext, Guid? userId = null)
{
userId ??= httpContext.User.GetUserId();
var user = userManager.GetUserById(userId.Value);
User? user = null;
if (!userId.IsNullOrEmpty())
{
user = userManager.GetUserById(userId.Value);
}
var session = await sessionManager.LogSessionActivity(
httpContext.User.GetClient(),
httpContext.User.GetVersion(),