From 77fdebc366172ecc2739605183fdef891760565f Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 30 Aug 2021 17:29:13 -0700 Subject: [PATCH] Do not unmonitor episodes after using Manual File Import --- .../HandleEpisodeFileDeletedFixture.cs | 15 +++++++++++++++ src/NzbDrone.Core/Tv/EpisodeService.cs | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/TvTests/EpisodeServiceTests/HandleEpisodeFileDeletedFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeServiceTests/HandleEpisodeFileDeletedFixture.cs index 723917287..6f90c9716 100644 --- a/src/NzbDrone.Core.Test/TvTests/EpisodeServiceTests/HandleEpisodeFileDeletedFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/EpisodeServiceTests/HandleEpisodeFileDeletedFixture.cs @@ -119,5 +119,20 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeServiceTests Mocker.GetMock() .Verify(v => v.ClearFileId(It.IsAny(), false), Times.Once()); } + + [Test] + public void should_leave_monitored_to_true_if_autoUnmonitor_is_true_and_is_for_manual_override() + { + GivenSingleEpisodeFile(); + + Mocker.GetMock() + .SetupGet(s => s.AutoUnmonitorPreviouslyDownloadedEpisodes) + .Returns(true); + + Subject.Handle(new EpisodeFileDeletedEvent(_episodeFile, DeleteMediaFileReason.ManualOverride)); + + Mocker.GetMock() + .Verify(v => v.ClearFileId(It.IsAny(), false), Times.Once()); + } } } diff --git a/src/NzbDrone.Core/Tv/EpisodeService.cs b/src/NzbDrone.Core/Tv/EpisodeService.cs index 226c7b3f6..8c0b7e5be 100644 --- a/src/NzbDrone.Core/Tv/EpisodeService.cs +++ b/src/NzbDrone.Core/Tv/EpisodeService.cs @@ -221,7 +221,7 @@ namespace NzbDrone.Core.Tv { _logger.Debug("Detaching episode {0} from file.", episode.Id); - var unmonitorForReason = message.Reason != DeleteMediaFileReason.Upgrade || + var unmonitorForReason = message.Reason != DeleteMediaFileReason.Upgrade && message.Reason != DeleteMediaFileReason.ManualOverride;