Browse Source

update sliders

Luke Pulverenti 9 years ago
parent
commit
ad663f8fa8

+ 1 - 0
MediaBrowser.Model/Configuration/ServerConfiguration.cs

@@ -201,6 +201,7 @@ namespace MediaBrowser.Model.Configuration
         public bool EnableFolderView { get; set; }
         public bool EnableFolderView { get; set; }
         public bool EnableGroupingIntoCollections { get; set; }
         public bool EnableGroupingIntoCollections { get; set; }
         public bool DisplaySpecialsWithinSeasons { get; set; }
         public bool DisplaySpecialsWithinSeasons { get; set; }
+        public bool DisplayCollectionsView { get; set; }
         public string[] LocalNetworkAddresses { get; set; }
         public string[] LocalNetworkAddresses { get; set; }
 
 
         /// <summary>
         /// <summary>

+ 1 - 1
MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs

@@ -20,7 +20,7 @@ namespace MediaBrowser.Server.Implementations.Collections
 
 
         public bool IsHiddenFromUser(User user)
         public bool IsHiddenFromUser(User user)
         {
         {
-            return !user.Configuration.DisplayCollectionsView;
+            return !ConfigurationManager.Configuration.DisplayCollectionsView;
         }
         }
 
 
         public override string CollectionType
         public override string CollectionType

+ 2 - 1
MediaBrowser.Server.Startup.Common/ApplicationHost.cs

@@ -382,7 +382,8 @@ namespace MediaBrowser.Server.Startup.Common
                 new MovieDbEpisodeProviderMigration(ServerConfigurationManager),
                 new MovieDbEpisodeProviderMigration(ServerConfigurationManager),
                 new DbMigration(ServerConfigurationManager, TaskManager),
                 new DbMigration(ServerConfigurationManager, TaskManager),
                 new FolderViewSettingMigration(ServerConfigurationManager, UserManager),
                 new FolderViewSettingMigration(ServerConfigurationManager, UserManager),
-                new CollectionGroupingMigration(ServerConfigurationManager, UserManager)
+                new CollectionGroupingMigration(ServerConfigurationManager, UserManager),
+                new CollectionsViewMigration(ServerConfigurationManager, UserManager)
             };
             };
 
 
             foreach (var task in migrations)
             foreach (var task in migrations)

+ 1 - 0
MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj

@@ -72,6 +72,7 @@
     <Compile Include="INativeApp.cs" />
     <Compile Include="INativeApp.cs" />
     <Compile Include="MbLinkShortcutHandler.cs" />
     <Compile Include="MbLinkShortcutHandler.cs" />
     <Compile Include="Migrations\CollectionGroupingMigration.cs" />
     <Compile Include="Migrations\CollectionGroupingMigration.cs" />
+    <Compile Include="Migrations\CollectionsViewMigration.cs" />
     <Compile Include="Migrations\FolderViewSettingMigration.cs" />
     <Compile Include="Migrations\FolderViewSettingMigration.cs" />
     <Compile Include="Migrations\IVersionMigration.cs" />
     <Compile Include="Migrations\IVersionMigration.cs" />
     <Compile Include="Migrations\DbMigration.cs" />
     <Compile Include="Migrations\DbMigration.cs" />

+ 44 - 0
MediaBrowser.Server.Startup.Common/Migrations/CollectionsViewMigration.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Library;
+
+namespace MediaBrowser.Server.Startup.Common.Migrations
+{
+    public class CollectionsViewMigration : IVersionMigration
+    {
+        private readonly IServerConfigurationManager _config;
+        private readonly IUserManager _userManager;
+
+        public CollectionsViewMigration(IServerConfigurationManager config, IUserManager userManager)
+        {
+            _config = config;
+            _userManager = userManager;
+        }
+
+        public void Run()
+        {
+            var migrationKey = this.GetType().Name;
+            var migrationKeyList = _config.Configuration.Migrations.ToList();
+
+            if (!migrationKeyList.Contains(migrationKey))
+            {
+                if (_config.Configuration.IsStartupWizardCompleted)
+                {
+                    if (_userManager.Users.Any(i => i.Configuration.DisplayCollectionsView))
+                    {
+                        _config.Configuration.DisplayCollectionsView = true;
+                    }
+                }
+
+                migrationKeyList.Add(migrationKey);
+                _config.Configuration.Migrations = migrationKeyList.ToArray();
+                _config.SaveConfiguration();
+            }
+
+        }
+    }
+}