1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed: Add list exclusion on delete

Fixes #3963
This commit is contained in:
Mark McDowall 2020-09-15 22:40:25 -07:00
parent 7ed347269f
commit cd2368f5f3
8 changed files with 40 additions and 14 deletions

View File

@ -98,7 +98,6 @@ class DeleteSeriesModalContent extends Component {
name="addImportListExclusion" name="addImportListExclusion"
value={addImportListExclusion} value={addImportListExclusion}
helpText="Prevent series from being added to Sonarr by lists" helpText="Prevent series from being added to Sonarr by lists"
kind={kinds.DANGER}
onChange={this.onAddImportListExclusionChange} onChange={this.onAddImportListExclusionChange}
/> />
</FormGroup> </FormGroup>

View File

@ -20,7 +20,8 @@ class DeleteSeriesModalContent extends Component {
super(props, context); super(props, context);
this.state = { this.state = {
deleteFiles: false deleteFiles: false,
addImportListExclusion: false
}; };
} }
@ -31,11 +32,18 @@ class DeleteSeriesModalContent extends Component {
this.setState({ deleteFiles: value }); this.setState({ deleteFiles: value });
} }
onDeleteSeriesConfirmed = () => { onAddImportListExclusionChange = ({ value }) => {
const deleteFiles = this.state.deleteFiles; this.setState({ addImportListExclusion: value });
}
this.setState({ deleteFiles: false }); onDeleteSeriesConfirmed = () => {
this.props.onDeleteSelectedPress(deleteFiles); const {
addImportListExclusion,
deleteFiles
} = this.state;
this.setState({ deleteFiles: false, addImportListExclusion: false });
this.props.onDeleteSelectedPress(deleteFiles, addImportListExclusion);
} }
// //
@ -46,7 +54,11 @@ class DeleteSeriesModalContent extends Component {
series, series,
onModalClose onModalClose
} = this.props; } = this.props;
const deleteFiles = this.state.deleteFiles;
const {
addImportListExclusion,
deleteFiles
} = this.state;
return ( return (
<ModalContent onModalClose={onModalClose}> <ModalContent onModalClose={onModalClose}>
@ -56,6 +68,18 @@ class DeleteSeriesModalContent extends Component {
<ModalBody> <ModalBody>
<div> <div>
<FormGroup>
<FormLabel>Add List Exclusion</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="addImportListExclusion"
value={addImportListExclusion}
helpText="Prevent series from being added to Sonarr by lists"
onChange={this.onAddImportListExclusionChange}
/>
</FormGroup>
<FormGroup> <FormGroup>
<FormLabel>{`Delete Series Folder${series.length > 1 ? 's' : ''}`}</FormLabel> <FormLabel>{`Delete Series Folder${series.length > 1 ? 's' : ''}`}</FormLabel>

View File

@ -31,10 +31,11 @@ function createMapStateToProps() {
function createMapDispatchToProps(dispatch, props) { function createMapDispatchToProps(dispatch, props) {
return { return {
onDeleteSelectedPress(deleteFiles) { onDeleteSelectedPress(deleteFiles, addImportListExclusion) {
dispatch(bulkDeleteSeries({ dispatch(bulkDeleteSeries({
seriesIds: props.seriesIds, seriesIds: props.seriesIds,
deleteFiles deleteFiles,
addImportListExclusion
})); }));
props.onModalClose(); props.onModalClose();

View File

@ -147,7 +147,7 @@ private void DeleteSeries(int id)
deleteFiles = Convert.ToBoolean(deleteFilesQuery.Value); deleteFiles = Convert.ToBoolean(deleteFilesQuery.Value);
} }
_seriesService.DeleteSeries(id, deleteFiles); _seriesService.DeleteSeries(id, deleteFiles, false);
} }
private SeriesResource MapToResource(Core.Tv.Series series, bool includeSeasonImages) private SeriesResource MapToResource(Core.Tv.Series series, bool includeSeasonImages)

View File

@ -22,7 +22,7 @@ public interface ISeriesService
Series FindByTitle(string title, int year); Series FindByTitle(string title, int year);
Series FindByTitleInexact(string title); Series FindByTitleInexact(string title);
Series FindByPath(string path); Series FindByPath(string path);
void DeleteSeries(int seriesId, bool deleteFiles, bool addImportListExclusion = false); void DeleteSeries(int seriesId, bool deleteFiles, bool addImportListExclusion);
List<Series> GetAllSeries(); List<Series> GetAllSeries();
List<Series> AllForTag(int tagId); List<Series> AllForTag(int tagId);
Series UpdateSeries(Series series, bool updateEpisodesToMatchSeason = true, bool publishUpdatedEvent = true); Series UpdateSeries(Series series, bool updateEpisodesToMatchSeason = true, bool publishUpdatedEvent = true);
@ -145,7 +145,7 @@ public Series FindByTitle(string title, int year)
return _seriesRepository.FindByTitle(title.CleanSeriesTitle(), year); return _seriesRepository.FindByTitle(title.CleanSeriesTitle(), year);
} }
public void DeleteSeries(int seriesId, bool deleteFiles, bool addImportListExclusion = false) public void DeleteSeries(int seriesId, bool deleteFiles, bool addImportListExclusion)
{ {
var series = _seriesRepository.Get(seriesId); var series = _seriesRepository.Get(seriesId);
_seriesRepository.Delete(seriesId); _seriesRepository.Delete(seriesId);

View File

@ -106,7 +106,7 @@ private object DeleteSeries()
foreach (var seriesId in resource.SeriesIds) foreach (var seriesId in resource.SeriesIds)
{ {
_seriesService.DeleteSeries(seriesId, resource.DeleteFiles); _seriesService.DeleteSeries(seriesId, resource.DeleteFiles, resource.AddImportListExclusion);
} }
return new object(); return new object();

View File

@ -16,6 +16,7 @@ public class SeriesEditorResource
public ApplyTags ApplyTags { get; set; } public ApplyTags ApplyTags { get; set; }
public bool MoveFiles { get; set; } public bool MoveFiles { get; set; }
public bool DeleteFiles { get; set; } public bool DeleteFiles { get; set; }
public bool AddImportListExclusion { get; set; }
} }
public enum ApplyTags public enum ApplyTags

View File

@ -169,8 +169,9 @@ private void UpdateSeries(SeriesResource seriesResource)
private void DeleteSeries(int id) private void DeleteSeries(int id)
{ {
var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles"); var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles");
var addImportListExclusion = Request.GetBooleanQueryParameter("addImportListExclusion");
_seriesService.DeleteSeries(id, deleteFiles); _seriesService.DeleteSeries(id, deleteFiles, addImportListExclusion);
} }
private SeriesResource GetSeriesResource(NzbDrone.Core.Tv.Series series, bool includeSeasonImages) private SeriesResource GetSeriesResource(NzbDrone.Core.Tv.Series series, bool includeSeasonImages)