Fixed: Add list exclusion on delete

Fixes #3963
pull/3986/head
Mark McDowall 4 years ago
parent 7ed347269f
commit cd2368f5f3

@ -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>

@ -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 });
} }
onAddImportListExclusionChange = ({ value }) => {
this.setState({ addImportListExclusion: value });
}
onDeleteSeriesConfirmed = () => { onDeleteSeriesConfirmed = () => {
const deleteFiles = this.state.deleteFiles; const {
addImportListExclusion,
deleteFiles
} = this.state;
this.setState({ deleteFiles: false }); this.setState({ deleteFiles: false, addImportListExclusion: false });
this.props.onDeleteSelectedPress(deleteFiles); 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>

@ -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();

@ -147,7 +147,7 @@ namespace NzbDrone.Api.Series
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)

@ -22,7 +22,7 @@ namespace NzbDrone.Core.Tv
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 @@ namespace NzbDrone.Core.Tv
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);

@ -106,7 +106,7 @@ namespace Sonarr.Api.V3.Series
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();

@ -16,6 +16,7 @@ namespace Sonarr.Api.V3.Series
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

@ -169,8 +169,9 @@ namespace Sonarr.Api.V3.Series
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)

Loading…
Cancel
Save