diff --git a/src/backend/middlewares/admin/SettingsMWs.ts b/src/backend/middlewares/admin/SettingsMWs.ts index 4e959298..ff8a3dbf 100644 --- a/src/backend/middlewares/admin/SettingsMWs.ts +++ b/src/backend/middlewares/admin/SettingsMWs.ts @@ -376,21 +376,11 @@ export class SettingsMWs { try { const settings: OtherConfigDTO = req.body.settings; - Config.Client.Other.enableCache = settings.Client.enableCache; - Config.Client.Other.captionFirstNaming = settings.Client.captionFirstNaming; - Config.Client.Other.enableOnScrollRendering = settings.Client.enableOnScrollRendering; - Config.Client.Other.enableOnScrollThumbnailPrioritising = settings.Client.enableOnScrollThumbnailPrioritising; - Config.Client.Other.defaultPhotoSortingMethod = settings.Client.defaultPhotoSortingMethod; - Config.Client.Other.NavBar.showItemCount = settings.Client.NavBar.showItemCount; + Config.Client.Other = settings.Client; // only updating explicitly set config (not saving config set by the diagnostics) const original = await Config.original(); - original.Client.Other.enableCache = settings.Client.enableCache; - original.Client.Other.captionFirstNaming = settings.Client.captionFirstNaming; - original.Client.Other.enableOnScrollRendering = settings.Client.enableOnScrollRendering; - original.Client.Other.enableOnScrollThumbnailPrioritising = settings.Client.enableOnScrollThumbnailPrioritising; - original.Client.Other.defaultPhotoSortingMethod = settings.Client.defaultPhotoSortingMethod; - original.Client.Other.NavBar.showItemCount = settings.Client.NavBar.showItemCount; + original.Client.Other = settings.Client; original.Server.Threading.enabled = settings.Server.enabled; original.Server.Threading.thumbnailThreads = settings.Server.thumbnailThreads; await original.save(); diff --git a/src/common/config/public/ClientConfig.ts b/src/common/config/public/ClientConfig.ts index 078dfcd0..7236c3f6 100644 --- a/src/common/config/public/ClientConfig.ts +++ b/src/common/config/public/ClientConfig.ts @@ -99,6 +99,8 @@ export module ClientConfig { enableOnScrollRendering: boolean = true; @ConfigProperty({type: SortingMethods}) defaultPhotoSortingMethod: SortingMethods = SortingMethods.ascDate; + @ConfigProperty({description: 'If enabled directories will be sorted by date, like photos, otherwise by name. Directory date is the last modification time of that directory not the creation date of the oldest photo'}) + enableDirectorySortingByDate: boolean = false; @ConfigProperty() enableOnScrollThumbnailPrioritising: boolean = true; @ConfigProperty() diff --git a/src/frontend/app/ui/gallery/gallery.component.ts b/src/frontend/app/ui/gallery/gallery.component.ts index 2ab6db6a..2f3f2d07 100644 --- a/src/frontend/app/ui/gallery/gallery.component.ts +++ b/src/frontend/app/ui/gallery/gallery.component.ts @@ -166,13 +166,21 @@ export class GalleryComponent implements OnInit, OnDestroy { this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare()(a.name, b.name)); break; case SortingMethods.ascDate: - this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare()(a.lastModified, b.lastModified)); + if (Config.Client.Other.enableDirectorySortingByDate === true) { + this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare()(a.lastModified, b.lastModified)); + break; + } + this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare()(a.name, b.name)); break; case SortingMethods.descName: this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({order: 'desc'})(a.name, b.name)); break; case SortingMethods.descDate: - this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({order: 'desc'})(a.lastModified, b.lastModified)); + if (Config.Client.Other.enableDirectorySortingByDate === true) { + this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({order: 'desc'})(a.lastModified, b.lastModified)); + break; + } + this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({order: 'desc'})(a.name, b.name)); break; case SortingMethods.random: this.rndService.setSeed(this.directories.length); diff --git a/src/frontend/app/ui/settings/other/other.settings.component.html b/src/frontend/app/ui/settings/other/other.settings.component.html index c839ca69..fd094f4d 100644 --- a/src/frontend/app/ui/settings/other/other.settings.component.html +++ b/src/frontend/app/ui/settings/other/other.settings.component.html @@ -77,6 +77,9 @@ + + + + + +