mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Don't Fail if User Tries Adding Existing Movie from Discovery
This commit is contained in:
@@ -521,12 +521,14 @@ export const actionHandlers = handleThunks({
|
|||||||
// Make sure we have a selected movie and
|
// Make sure we have a selected movie and
|
||||||
// the same movie hasn't been added yet.
|
// the same movie hasn't been added yet.
|
||||||
if (selectedMovie && !acc.some((a) => a.tmdbId === selectedMovie.tmdbId)) {
|
if (selectedMovie && !acc.some((a) => a.tmdbId === selectedMovie.tmdbId)) {
|
||||||
|
if (!selectedMovie.isExisting) {
|
||||||
const newMovie = getNewMovie(_.cloneDeep(selectedMovie), addOptions);
|
const newMovie = getNewMovie(_.cloneDeep(selectedMovie), addOptions);
|
||||||
newMovie.id = 0;
|
newMovie.id = 0;
|
||||||
|
|
||||||
addedIds.push(id);
|
addedIds.push(id);
|
||||||
acc.push(newMovie);
|
acc.push(newMovie);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
@@ -548,24 +550,19 @@ export const actionHandlers = handleThunks({
|
|||||||
|
|
||||||
...data.map((movie) => updateItem({ section: 'movies', ...movie })),
|
...data.map((movie) => updateItem({ section: 'movies', ...movie })),
|
||||||
|
|
||||||
...addedIds.map((id) => removeItem({ section, id }))
|
...addedIds.map((id) => (items.find((i) => i.id === id).lists.length === 0 ? removeItem({ section, id }) : updateItem({ section, id, isExisting: true })))
|
||||||
|
|
||||||
]));
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
promise.fail((xhr) => {
|
promise.fail((xhr) => {
|
||||||
dispatch(batchActions(
|
dispatch(
|
||||||
set({
|
set({
|
||||||
section,
|
section,
|
||||||
isImporting: false,
|
isAdding: false,
|
||||||
isImported: true
|
isAdded: true
|
||||||
}),
|
})
|
||||||
|
);
|
||||||
addedIds.map((id) => updateItem({
|
|
||||||
section,
|
|
||||||
id,
|
|
||||||
importError: xhr
|
|
||||||
}))
|
|
||||||
));
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user