From c0ea803611e2d8a7e23eb54bc03cd0f90b07c109 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 26 Feb 2020 12:13:43 +0000 Subject: [PATCH] Fixed #3409 and also a error when sending whatsapp notifications --- src/Ombi.Api.Twilio/WhatsAppApi.cs | 4 ++++ .../Rule/Rules/Request/ExistingPlexRequestRule.cs | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Ombi.Api.Twilio/WhatsAppApi.cs b/src/Ombi.Api.Twilio/WhatsAppApi.cs index 5290a02ec..439a49c6d 100644 --- a/src/Ombi.Api.Twilio/WhatsAppApi.cs +++ b/src/Ombi.Api.Twilio/WhatsAppApi.cs @@ -12,6 +12,10 @@ namespace Ombi.Api.Twilio { TwilioClient.Init(accountSid, authToken); + if(string.IsNullOrEmpty(message.To)) + { + return string.Empty; + } var response =await MessageResource.CreateAsync( body: message.Message, from: new PhoneNumber($"whatsapp:{message.From}"), diff --git a/src/Ombi.Core/Rule/Rules/Request/ExistingPlexRequestRule.cs b/src/Ombi.Core/Rule/Rules/Request/ExistingPlexRequestRule.cs index 3dac2ceff..9d4ab30ef 100644 --- a/src/Ombi.Core/Rule/Rules/Request/ExistingPlexRequestRule.cs +++ b/src/Ombi.Core/Rule/Rules/Request/ExistingPlexRequestRule.cs @@ -29,15 +29,15 @@ namespace Ombi.Core.Rule.Rules.Request if (obj.RequestType == RequestType.TvShow) { var tvRequest = (ChildRequests) obj; - - var tvContent = _plexContent.GetAll().Where(x => x.Type == PlexMediaTypeEntity.Show); + + var tvContent = _plexContent.GetAll().Include(x => x.Episodes).Where(x => x.Type == PlexMediaTypeEntity.Show); // We need to do a check on the TVDBId - var anyTvDbMatches = await tvContent.Include(x => x.Episodes).FirstOrDefaultAsync(x => x.HasTvDb && x.TvDbId == tvRequest.Id.ToString()); // the Id on the child is the tvdbid at this point + var anyTvDbMatches = await tvContent.FirstOrDefaultAsync(x => x.TvDbId.Length > 0 && x.TvDbId == tvRequest.Id.ToString()); // the Id on the child is the tvdbid at this point if (anyTvDbMatches == null) { // So we do not have a TVDB Id, that really sucks. // Let's try and match on the title and year of the show - var titleAndYearMatch = await tvContent.Include(x=> x.Episodes).FirstOrDefaultAsync(x => + var titleAndYearMatch = await tvContent.FirstOrDefaultAsync(x => x.Title == tvRequest.Title && x.ReleaseYear == tvRequest.ReleaseYear.Year.ToString()); if (titleAndYearMatch != null)