diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d1f674e2..8515d35c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ * As a side-effect, any UI settings (like volume, view modes) from the previous version get discarded upon the SW update * Also, volume settings in the Share and Files embedded players are now distint from the volume in the main app - Small optimization on the size of the `collection.json` loaded by the web front-end +- Order the playlists by name in the navigation pane, navigate automatically to the created or renamed playlist + [#1083](https://github.com/owncloud/music/issues/1083) ### Fixed - Subsonic: Unhandled exception when attempting to delete a non-existent bookmark diff --git a/js/app/controllers/navigationcontroller.js b/js/app/controllers/navigationcontroller.js index 66d56748e..fd919597b 100644 --- a/js/app/controllers/navigationcontroller.js +++ b/js/app/controllers/navigationcontroller.js @@ -95,6 +95,8 @@ angular.module('Music').controller('NavigationController', [ playlist.updated = result.updated; }); $scope.showEditForm = null; + libraryService.sortPlaylists(); + $timeout(() => $scope.navigateTo(`#playlist/${playlist.id}`)); } }; @@ -323,6 +325,7 @@ angular.module('Music').controller('NavigationController', [ }; Restangular.all('playlists').post(args).then(function(playlist) { libraryService.addPlaylist(playlist); + $timeout(() => $scope.navigateTo(`#playlist/${playlist.id}`)); }); } diff --git a/js/app/services/libraryservice.ts b/js/app/services/libraryservice.ts index a43fc692c..71cdabc95 100644 --- a/js/app/services/libraryservice.ts +++ b/js/app/services/libraryservice.ts @@ -363,6 +363,7 @@ export class LibraryService { } setPlaylists(lists : any[]) : void { this.#playlists = _.map(lists, (list) => this.#wrapPlaylist(list)); + this.sortPlaylists(); } setSmartList(list : any) : void { if (!list) { @@ -472,8 +473,12 @@ export class LibraryService { let idx = _.findIndex(this.#podcastChannels, { id: channel.id }); this.#podcastChannels.splice(idx, 1); } + sortPlaylists() : void { + this.#sortByTextField(this.#playlists, 'name'); + } addPlaylist(playlist : any) : void { this.#playlists.push(this.#wrapPlaylist(playlist)); + this.sortPlaylists(); } removePlaylist(playlist : any) : void { this.#playlists.splice(this.#playlists.indexOf(playlist), 1);