mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 02:18:54 -07:00
fixed empty user display on dashboard
This commit is contained in:
parent
e8634cbafd
commit
3f23ee9e82
@ -20,7 +20,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
private SQLiteConnection _connection;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the repository
|
||||
/// </summary>
|
||||
@ -192,7 +192,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
var idParam = cmd.Parameters.Add("@id", DbType.Guid);
|
||||
idParam.Value = displayPreferencesId;
|
||||
|
||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult | CommandBehavior.SingleRow))
|
||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult | CommandBehavior.SingleRow))
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
@ -203,7 +203,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return new DisplayPreferences { Id = displayPreferencesId };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,5 +1,4 @@
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Session;
|
||||
using MediaBrowser.Model.Session;
|
||||
using MediaBrowser.Model.System;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
@ -34,12 +33,6 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
/// </summary>
|
||||
/// <value>The active connections.</value>
|
||||
public SessionInfoDto[] ActiveConnections { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the users.
|
||||
/// </summary>
|
||||
/// <value>The users.</value>
|
||||
public UserDto[] Users { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,11 +30,6 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
/// <value>The task manager.</value>
|
||||
private readonly ITaskManager _taskManager;
|
||||
|
||||
/// <summary>
|
||||
/// The _user manager
|
||||
/// </summary>
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ISessionManager _sessionManager;
|
||||
|
||||
/// <summary>
|
||||
@ -43,15 +38,12 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
/// <param name="appHost">The app host.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
public DashboardInfoWebSocketListener(IServerApplicationHost appHost, ILogger logger, ITaskManager taskManager, IUserManager userManager, ILibraryManager libraryManager, ISessionManager sessionManager)
|
||||
/// <param name="sessionManager">The session manager.</param>
|
||||
public DashboardInfoWebSocketListener(IServerApplicationHost appHost, ILogger logger, ITaskManager taskManager, ISessionManager sessionManager)
|
||||
: base(logger)
|
||||
{
|
||||
_appHost = appHost;
|
||||
_taskManager = taskManager;
|
||||
_userManager = userManager;
|
||||
_libraryManager = libraryManager;
|
||||
_sessionManager = sessionManager;
|
||||
}
|
||||
|
||||
@ -62,7 +54,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
/// <returns>Task{IEnumerable{TaskInfo}}.</returns>
|
||||
protected override Task<DashboardInfo> GetDataToSend(object state)
|
||||
{
|
||||
return DashboardService.GetDashboardInfo(_appHost, Logger, _taskManager, _userManager, _libraryManager, _sessionManager);
|
||||
return Task.FromResult(DashboardService.GetDashboardInfo(_appHost, _taskManager, _sessionManager));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,19 +107,10 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
/// <value>The task manager.</value>
|
||||
private readonly ITaskManager _taskManager;
|
||||
|
||||
/// <summary>
|
||||
/// The _user manager
|
||||
/// </summary>
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
/// <summary>
|
||||
/// The _app host
|
||||
/// </summary>
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
/// <summary>
|
||||
/// The _library manager
|
||||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
/// <summary>
|
||||
/// The _server configuration manager
|
||||
@ -132,16 +123,13 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
/// Initializes a new instance of the <see cref="DashboardService" /> class.
|
||||
/// </summary>
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
/// <param name="appHost">The app host.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="serverConfigurationManager">The server configuration manager.</param>
|
||||
public DashboardService(ITaskManager taskManager, IUserManager userManager, IServerApplicationHost appHost, ILibraryManager libraryManager, IServerConfigurationManager serverConfigurationManager, ISessionManager sessionManager)
|
||||
/// <param name="sessionManager">The session manager.</param>
|
||||
public DashboardService(ITaskManager taskManager, IServerApplicationHost appHost, IServerConfigurationManager serverConfigurationManager, ISessionManager sessionManager)
|
||||
{
|
||||
_taskManager = taskManager;
|
||||
_userManager = userManager;
|
||||
_appHost = appHost;
|
||||
_libraryManager = libraryManager;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
_sessionManager = sessionManager;
|
||||
}
|
||||
@ -182,7 +170,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
/// <returns>System.Object.</returns>
|
||||
public object Get(GetDashboardInfo request)
|
||||
{
|
||||
var result = GetDashboardInfo(_appHost, Logger, _taskManager, _userManager, _libraryManager, _sessionManager).Result;
|
||||
var result = GetDashboardInfo(_appHost, _taskManager, _sessionManager);
|
||||
|
||||
return ResultFactory.GetOptimizedResult(RequestContext, result);
|
||||
}
|
||||
@ -191,27 +179,15 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
/// Gets the dashboard info.
|
||||
/// </summary>
|
||||
/// <param name="appHost">The app host.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="connectionManager">The connection manager.</param>
|
||||
/// <returns>DashboardInfo.</returns>
|
||||
public static async Task<DashboardInfo> GetDashboardInfo(IServerApplicationHost appHost,
|
||||
ILogger logger,
|
||||
public static DashboardInfo GetDashboardInfo(IServerApplicationHost appHost,
|
||||
ITaskManager taskManager,
|
||||
IUserManager userManager,
|
||||
ILibraryManager libraryManager,
|
||||
ISessionManager connectionManager)
|
||||
{
|
||||
var connections = connectionManager.Sessions.Where(i => i.IsActive).ToArray();
|
||||
|
||||
var dtoBuilder = new UserDtoBuilder(logger);
|
||||
|
||||
var tasks = userManager.Users.Where(u => connections.Any(c => c.User != null && c.User.Id == u.Id)).Select(dtoBuilder.GetUserDto);
|
||||
|
||||
var users = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
return new DashboardInfo
|
||||
{
|
||||
SystemInfo = appHost.GetSystemInfo(),
|
||||
@ -222,9 +198,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
|
||||
ApplicationUpdateTaskId = taskManager.ScheduledTasks.First(t => t.ScheduledTask.GetType().Name.Equals("SystemUpdateTask", StringComparison.OrdinalIgnoreCase)).Id,
|
||||
|
||||
ActiveConnections = connections.Select(SessionInfoDtoBuilder.GetSessionInfoDto).ToArray(),
|
||||
|
||||
Users = users.ToArray()
|
||||
ActiveConnections = connections.Select(SessionInfoDtoBuilder.GetSessionInfoDto).ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user