Fixed #3409 and also a error when sending whatsapp notifications

pull/3528/head
tidusjar 5 years ago
parent 2bf67ffafe
commit c0ea803611

@ -12,6 +12,10 @@ namespace Ombi.Api.Twilio
{ {
TwilioClient.Init(accountSid, authToken); TwilioClient.Init(accountSid, authToken);
if(string.IsNullOrEmpty(message.To))
{
return string.Empty;
}
var response =await MessageResource.CreateAsync( var response =await MessageResource.CreateAsync(
body: message.Message, body: message.Message,
from: new PhoneNumber($"whatsapp:{message.From}"), from: new PhoneNumber($"whatsapp:{message.From}"),

@ -30,14 +30,14 @@ namespace Ombi.Core.Rule.Rules.Request
{ {
var tvRequest = (ChildRequests) obj; 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 // 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) if (anyTvDbMatches == null)
{ {
// So we do not have a TVDB Id, that really sucks. // So we do not have a TVDB Id, that really sucks.
// Let's try and match on the title and year of the show // 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.Title == tvRequest.Title
&& x.ReleaseYear == tvRequest.ReleaseYear.Year.ToString()); && x.ReleaseYear == tvRequest.ReleaseYear.Year.ToString());
if (titleAndYearMatch != null) if (titleAndYearMatch != null)

Loading…
Cancel
Save