mirror of https://github.com/Radarr/Radarr
Fixed: Remove Collection on last Movie delete
This commit is contained in:
parent
5dc541c69e
commit
737a0176d4
|
@ -21,13 +21,13 @@ namespace NzbDrone.Core.Movies.Collections
|
|||
public class MovieCollectionService : IMovieCollectionService, IHandleAsync<MoviesDeletedEvent>
|
||||
{
|
||||
private readonly IMovieCollectionRepository _repo;
|
||||
private readonly IMovieMetadataService _movieMetadataService;
|
||||
private readonly IMovieService _movieService;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
|
||||
public MovieCollectionService(IMovieCollectionRepository repo, IMovieMetadataService movieMetadataService, IEventAggregator eventAggregator)
|
||||
public MovieCollectionService(IMovieCollectionRepository repo, IMovieService movieService, IEventAggregator eventAggregator)
|
||||
{
|
||||
_repo = repo;
|
||||
_movieMetadataService = movieMetadataService;
|
||||
_movieService = movieService;
|
||||
_eventAggregator = eventAggregator;
|
||||
}
|
||||
|
||||
|
@ -96,16 +96,16 @@ namespace NzbDrone.Core.Movies.Collections
|
|||
|
||||
foreach (var collectionTmdbId in collections)
|
||||
{
|
||||
if (collectionTmdbId == 0 || _movieMetadataService.GetMoviesByCollectionTmdbId(collectionTmdbId).Any())
|
||||
if (collectionTmdbId == 0 || _movieService.GetMoviesByCollectionTmdbId(collectionTmdbId).Any())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var collection = FindByTmdbId(collectionTmdbId);
|
||||
|
||||
_eventAggregator.PublishEvent(new CollectionDeletedEvent(collection));
|
||||
|
||||
_repo.Delete(collectionTmdbId);
|
||||
|
||||
_eventAggregator.PublishEvent(new CollectionDeletedEvent(collection));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue