1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-21 22:05:38 -04:00

New: Limit recent folders in Manual import to 10 and descending order

Closes #3491
This commit is contained in:
Mark McDowall
2020-01-07 17:36:57 -08:00
parent bc0da03caf
commit d3cd46bb51
2 changed files with 9 additions and 5 deletions
@@ -19,6 +19,8 @@ const episodesSection = `${section}.episodes`;
let abortCurrentRequest = null;
let currentIds = [];
const MAXIMUM_RECENT_FOLDERS = 10;
//
// State
@@ -249,12 +251,14 @@ export const reducers = createHandleActions({
const index = recentFolders.findIndex((r) => r.folder === folder);
if (index > -1) {
recentFolders.splice(index, 1, recentFolder);
} else {
recentFolders.push(recentFolder);
recentFolders.splice(index, 1);
}
return Object.assign({}, state, { recentFolders });
recentFolders.push(recentFolder);
const sliceIndex = Math.max(recentFolders.length - MAXIMUM_RECENT_FOLDERS, 0);
return Object.assign({}, state, { recentFolders: recentFolders.slice(sliceIndex) });
},
[REMOVE_RECENT_FOLDER]: function(state, { payload }) {