diff options
| author | crobibero <cody@robibe.ro> | 2020-12-04 16:00:11 -0700 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-12-04 16:00:11 -0700 |
| commit | 3db6ae91f6aa68a1eaf3da3d385b069bdd7721ee (patch) | |
| tree | 7e4092397fdfb1f5c6e33ca5ea464cddb7c90996 /Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs | |
| parent | 8d8738835ecc36c6f00157d4131d8200d5dd582a (diff) | |
Add ItemId to all display preferences
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs index 1f3b4ff17..c8a589cab 100644 --- a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs +++ b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs @@ -26,16 +26,16 @@ namespace Jellyfin.Server.Implementations.Users } /// <inheritdoc /> - public DisplayPreferences GetDisplayPreferences(Guid userId, string client) + public DisplayPreferences GetDisplayPreferences(Guid userId, Guid itemId, string client) { var prefs = _dbContext.DisplayPreferences .Include(pref => pref.HomeSections) .FirstOrDefault(pref => - pref.UserId == userId && string.Equals(pref.Client, client)); + pref.UserId == userId && string.Equals(pref.Client, client) && pref.ItemId == itemId); if (prefs == null) { - prefs = new DisplayPreferences(userId, client); + prefs = new DisplayPreferences(userId, itemId, client); _dbContext.DisplayPreferences.Add(prefs); } @@ -67,26 +67,30 @@ namespace Jellyfin.Server.Implementations.Users } /// <inheritdoc /> - public IDictionary<string, string> ListCustomItemDisplayPreferences(Guid userId, string client) + public IDictionary<string, string> ListCustomItemDisplayPreferences(Guid userId, Guid itemId, string client) { return _dbContext.CustomItemDisplayPreferences .AsQueryable() - .Where(prefs => prefs.UserId == userId && string.Equals(prefs.Client, client)) + .Where(prefs => prefs.UserId == userId + && prefs.ItemId == itemId + && string.Equals(prefs.Client, client)) .ToDictionary(prefs => prefs.Key, prefs => prefs.Value); } /// <inheritdoc /> - public void SetCustomItemDisplayPreferences(Guid userId, string client, Dictionary<string, string> customPreferences) + public void SetCustomItemDisplayPreferences(Guid userId, Guid itemId, string client, Dictionary<string, string> customPreferences) { var existingPrefs = _dbContext.CustomItemDisplayPreferences .AsQueryable() - .Where(prefs => prefs.UserId == userId && string.Equals(prefs.Client, client)); + .Where(prefs => prefs.UserId == userId + && prefs.ItemId == itemId + && string.Equals(prefs.Client, client)); _dbContext.CustomItemDisplayPreferences.RemoveRange(existingPrefs); foreach (var (key, value) in customPreferences) { _dbContext.CustomItemDisplayPreferences - .Add(new CustomItemDisplayPreferences(userId, client, key, value)); + .Add(new CustomItemDisplayPreferences(userId, itemId, client, key, value)); } } |
