mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
Add support for custom item display preferences
This commit is contained in:
@@ -66,6 +66,30 @@ namespace Jellyfin.Server.Implementations.Users
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IDictionary<string, string> ListCustomItemDisplayPreferences(Guid userId, string client)
|
||||
{
|
||||
return _dbContext.CustomItemDisplayPreferences
|
||||
.AsQueryable()
|
||||
.Where(prefs => prefs.UserId == userId && string.Equals(prefs.Client, client))
|
||||
.ToDictionary(prefs => prefs.Key, prefs => prefs.Value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetCustomItemDisplayPreferences(Guid userId, string client, Dictionary<string, string> customPreferences)
|
||||
{
|
||||
var existingPrefs = _dbContext.CustomItemDisplayPreferences
|
||||
.AsQueryable()
|
||||
.Where(prefs => prefs.UserId == userId && string.Equals(prefs.Client, client));
|
||||
_dbContext.CustomItemDisplayPreferences.RemoveRange(existingPrefs);
|
||||
|
||||
foreach (var (key, value) in customPreferences)
|
||||
{
|
||||
_dbContext.CustomItemDisplayPreferences
|
||||
.Add(new CustomItemDisplayPreferences(userId, client, key, value));
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SaveChanges()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user