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"
value={addImportListExclusion}
helpText="Prevent series from being added to Sonarr by lists"
kind={kinds.DANGER}
onChange={this.onAddImportListExclusionChange}
/>
</FormGroup>

@ -20,7 +20,8 @@ class DeleteSeriesModalContent extends Component {
super(props, context);
this.state = {
deleteFiles: false
deleteFiles: false,
addImportListExclusion: false
};
}
@ -31,11 +32,18 @@ class DeleteSeriesModalContent extends Component {
this.setState({ deleteFiles: value });
}
onAddImportListExclusionChange = ({ value }) => {
this.setState({ addImportListExclusion: value });
}
onDeleteSeriesConfirmed = () => {
const deleteFiles = this.state.deleteFiles;
const {
addImportListExclusion,
deleteFiles
} = this.state;
this.setState({ deleteFiles: false });
this.props.onDeleteSelectedPress(deleteFiles);
this.setState({ deleteFiles: false, addImportListExclusion: false });
this.props.onDeleteSelectedPress(deleteFiles, addImportListExclusion);
}
//
@ -46,7 +54,11 @@ class DeleteSeriesModalContent extends Component {
series,
onModalClose
} = this.props;
const deleteFiles = this.state.deleteFiles;
const {
addImportListExclusion,
deleteFiles
} = this.state;
return (
<ModalContent onModalClose={onModalClose}>
@ -56,6 +68,18 @@ class DeleteSeriesModalContent extends Component {
<ModalBody>
<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>
<FormLabel>{`Delete Series Folder${series.length > 1 ? 's' : ''}`}</FormLabel>

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

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

@ -22,7 +22,7 @@ namespace NzbDrone.Core.Tv
Series FindByTitle(string title, int year);
Series FindByTitleInexact(string title);
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> AllForTag(int tagId);
Series UpdateSeries(Series series, bool updateEpisodesToMatchSeason = true, bool publishUpdatedEvent = true);
@ -145,7 +145,7 @@ namespace NzbDrone.Core.Tv
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);
_seriesRepository.Delete(seriesId);

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

@ -16,6 +16,7 @@ namespace Sonarr.Api.V3.Series
public ApplyTags ApplyTags { get; set; }
public bool MoveFiles { get; set; }
public bool DeleteFiles { get; set; }
public bool AddImportListExclusion { get; set; }
}
public enum ApplyTags

@ -169,8 +169,9 @@ namespace Sonarr.Api.V3.Series
private void DeleteSeries(int id)
{
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)

Loading…
Cancel
Save