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

View File

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

View File

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

View File

@ -147,7 +147,7 @@ private void DeleteSeries(int id)
deleteFiles = Convert.ToBoolean(deleteFilesQuery.Value);
}
_seriesService.DeleteSeries(id, deleteFiles);
_seriesService.DeleteSeries(id, deleteFiles, false);
}
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 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 @@ public Series FindByTitle(string title, int 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);
_seriesRepository.Delete(seriesId);

View File

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

View File

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

View File

@ -169,8 +169,9 @@ private void UpdateSeries(SeriesResource seriesResource)
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)