From 817c4f9ec16428d8c12e5310081e8e0605b69598 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 8 Feb 2018 09:46:52 +0000 Subject: [PATCH] !wip missing changes --- src/Ombi.Notifications/Agents/EmailNotification.cs | 10 ++++++---- src/Ombi/Controllers/IssuesController.cs | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Ombi.Notifications/Agents/EmailNotification.cs b/src/Ombi.Notifications/Agents/EmailNotification.cs index d207fda65..b43b3a77f 100644 --- a/src/Ombi.Notifications/Agents/EmailNotification.cs +++ b/src/Ombi.Notifications/Agents/EmailNotification.cs @@ -151,6 +151,10 @@ namespace Ombi.Notifications.Agents protected override async Task IssueResolved(NotificationOptions model, EmailNotificationSettings settings) { + if (!model.Recipient.HasValue()) + { + return; + } var message = await LoadTemplate(NotificationType.IssueResolved, model, settings); if (message == null) { @@ -161,10 +165,8 @@ namespace Ombi.Notifications.Agents message.Other.Add("PlainTextBody", plaintext); // Issues resolved should be sent to the user - message.To = model.RequestType == RequestType.Movie - ? MovieRequest.RequestedUser.Email - : TvRequest.RequestedUser.Email; - + message.To = model.Recipient; + await Send(message, settings); } diff --git a/src/Ombi/Controllers/IssuesController.cs b/src/Ombi/Controllers/IssuesController.cs index 0d0f38d74..ed7eb7e6a 100644 --- a/src/Ombi/Controllers/IssuesController.cs +++ b/src/Ombi/Controllers/IssuesController.cs @@ -233,7 +233,7 @@ namespace Ombi.Controllers { var user = await _userManager.Users.Where(x => User.Identity.Name == x.UserName) .FirstOrDefaultAsync(); - var issue = await _issues.Find(model.IssueId); + var issue = await _issues.GetAll().Include(x => x.UserReported).FirstOrDefaultAsync(x => x.Id == model.IssueId); if (issue == null) { return false; @@ -254,7 +254,8 @@ namespace Ombi.Controllers ? issue.UserReported.Email : string.Empty, AdditionalInformation = $"{issue.Subject} | {issue.Description}", - UserId = user.Id + UserId = user.Id, + }; AddIssueNotificationSubstitutes(notificationModel, issue);