diff --git a/src/Ombi.Core/Engine/MovieSearchEngine.cs b/src/Ombi.Core/Engine/MovieSearchEngine.cs index 682a999eb..76cb13968 100644 --- a/src/Ombi.Core/Engine/MovieSearchEngine.cs +++ b/src/Ombi.Core/Engine/MovieSearchEngine.cs @@ -16,7 +16,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Security.Principal; using System.Threading.Tasks; namespace Ombi.Core.Engine @@ -216,34 +215,9 @@ protected async Task ProcessSingleMovie(SearchMovieViewMod await RunSearchRules(viewMovie); - // This requires the rules to be run first to populate the RequestId property - await CheckForSubscription(viewMovie); - return viewMovie; } - private async Task CheckForSubscription(SearchMovieViewModel viewModel) - { - // Check if this user requested it - var user = await GetUser(); - if (user == null) - { - return; - } - var request = await RequestService.MovieRequestService.GetAll() - .AnyAsync(x => x.RequestedUserId.Equals(user.Id) && x.TheMovieDbId == viewModel.Id); - if (request || viewModel.Available) - { - viewModel.ShowSubscribe = false; - } - else - { - viewModel.ShowSubscribe = true; - var sub = await _subscriptionRepository.GetAll().FirstOrDefaultAsync(s => s.UserId == user.Id - && s.RequestId == viewModel.RequestId && s.RequestType == RequestType.Movie); - viewModel.Subscribed = sub != null; - } - } private async Task ProcessSingleMovie(MovieDbSearchResult movie) { diff --git a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs index 3acd7d1f0..cb242b1c6 100644 --- a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs +++ b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs @@ -393,8 +393,6 @@ private async Task ProcessSingleMovie(FullMovieInfo movi await RunSearchRules(viewMovie); - // This requires the rules to be run first to populate the RequestId property - await CheckForSubscription(viewMovie); var mapped = Mapper.Map(movie); mapped.Available = viewMovie.Available; @@ -406,8 +404,6 @@ private async Task ProcessSingleMovie(FullMovieInfo movi mapped.PlexUrl = viewMovie.PlexUrl; mapped.EmbyUrl = viewMovie.EmbyUrl; mapped.JellyfinUrl = viewMovie.JellyfinUrl; - mapped.Subscribed = viewMovie.Subscribed; - mapped.ShowSubscribe = viewMovie.ShowSubscribe; mapped.DigitalReleaseDate = viewMovie.DigitalReleaseDate; mapped.RequestedDate4k = viewMovie.RequestedDate4k; mapped.Approved4K = viewMovie.Approved4K; @@ -429,8 +425,6 @@ private async Task ProcessCollection(Collections coll var mappedMovie = Mapper.Map(movie); await RunSearchRules(mappedMovie); - // This requires the rules to be run first to populate the RequestId property - await CheckForSubscription(mappedMovie); var mapped = Mapper.Map(movie); mapped.Available = movie.Available; @@ -440,8 +434,6 @@ private async Task ProcessCollection(Collections coll mapped.PlexUrl = movie.PlexUrl; mapped.EmbyUrl = movie.EmbyUrl; mapped.JellyfinUrl = movie.JellyfinUrl; - mapped.Subscribed = movie.Subscribed; - mapped.ShowSubscribe = movie.ShowSubscribe; mapped.ReleaseDate = movie.ReleaseDate; } return viewMovie; @@ -470,34 +462,9 @@ private async Task ProcessSingleMovie(SearchMovieViewModel await RunSearchRules(viewMovie); - // This requires the rules to be run first to populate the RequestId property - await CheckForSubscription(viewMovie); - return viewMovie; } - private async Task CheckForSubscription(SearchViewModel viewModel) - { - // Check if this user requested it - var user = await GetUser(); - if (user == null) - { - return; - } - var request = await RequestService.MovieRequestService.GetAll() - .AnyAsync(x => x.RequestedUserId.Equals(user.Id) && x.TheMovieDbId == viewModel.Id); - if (request) - { - viewModel.ShowSubscribe = false; - } - else - { - viewModel.ShowSubscribe = true; - var sub = await _subscriptionRepository.GetAll().FirstOrDefaultAsync(s => s.UserId == user.Id - && s.RequestId == viewModel.RequestId && s.RequestType == RequestType.Movie); - viewModel.Subscribed = sub != null; - } - } public async Task GetMovieInfoByImdbId(string imdbId, CancellationToken cancellationToken) { diff --git a/src/Ombi.Core/Models/Search/SearchViewModel.cs b/src/Ombi.Core/Models/Search/SearchViewModel.cs index e1a2f2850..4dda0444e 100644 --- a/src/Ombi.Core/Models/Search/SearchViewModel.cs +++ b/src/Ombi.Core/Models/Search/SearchViewModel.cs @@ -36,6 +36,7 @@ public abstract class SearchViewModel [Obsolete("Use request service instead")] public bool Subscribed { get; set; } [NotMapped] + [Obsolete("Use request service instead")] public bool ShowSubscribe { get; set; } } }