Merge pull request #1287 from dhruvb14/dev

Quick fix for email false positive message. ISSUE: #1286
pull/1295/head
Jamie 8 years ago committed by GitHub
commit 830c887d98

@ -138,7 +138,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
if (embySettings.Enable) if (embySettings.Enable)
{ {
var letter = EmbyNewsletter.GetNewsletter(testEmail) ?? new Newsletter(); var letter = EmbyNewsletter.GetNewsletter(testEmail) ?? new Newsletter();
if (letter.Send) if (letter.Send || testEmail)
{ {
SendNewsletter(newletterSettings, letter.Html, testEmail, "New Content On Emby!"); SendNewsletter(newletterSettings, letter.Html, testEmail, "New Content On Emby!");
} }
@ -153,7 +153,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
if (plexSettings.Enable) if (plexSettings.Enable)
{ {
var letter = PlexNewsletter.GetNewsletter(testEmail) ?? new Newsletter(); var letter = PlexNewsletter.GetNewsletter(testEmail) ?? new Newsletter();
if (letter.Send) if (letter.Send || testEmail)
{ {
SendNewsletter(newletterSettings, letter.Html, testEmail); SendNewsletter(newletterSettings, letter.Html, testEmail);
} }

@ -227,6 +227,7 @@ namespace Ombi.Services.Notification
catch (Exception e) catch (Exception e)
{ {
Log.Error(e); Log.Error(e);
throw new InvalidOperationException(e.Message);
} }
} }

@ -97,6 +97,7 @@ namespace Ombi.Services.Notification
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex, $"Notification '{notification.NotificationName}' failed with exception"); Log.Error(ex, $"Notification '{notification.NotificationName}' failed with exception");
throw new InvalidOperationException(ex.Message);
} }
} }
} }

@ -126,7 +126,7 @@ namespace Ombi.UI.Modules.Admin
ISlackApi slackApi, ISettingsService<LandingPageSettings> lp, ISlackApi slackApi, ISettingsService<LandingPageSettings> lp,
ISettingsService<ScheduledJobsSettings> scheduler, IJobRecord rec, IAnalytics analytics, ISettingsService<ScheduledJobsSettings> scheduler, IJobRecord rec, IAnalytics analytics,
ISettingsService<NotificationSettingsV2> notifyService, IRecentlyAdded recentlyAdded, IMassEmail massEmail, ISettingsService<NotificationSettingsV2> notifyService, IRecentlyAdded recentlyAdded, IMassEmail massEmail,
ISettingsService<WatcherSettings> watcherSettings , ISettingsService<WatcherSettings> watcherSettings,
ISettingsService<DiscordNotificationSettings> discord, ISettingsService<DiscordNotificationSettings> discord,
IDiscordApi discordapi, ISettingsService<RadarrSettings> settings, IRadarrApi radarrApi, IDiscordApi discordapi, ISettingsService<RadarrSettings> settings, IRadarrApi radarrApi,
ISettingsService<EmbySettings> embySettings, IEmbyApi emby ISettingsService<EmbySettings> embySettings, IEmbyApi emby
@ -168,9 +168,9 @@ namespace Ombi.UI.Modules.Admin
RadarrApi = radarrApi; RadarrApi = radarrApi;
EmbyApi = emby; EmbyApi = emby;
EmbySettings = embySettings; EmbySettings = embySettings;
Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx); Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);
Get["/"] = _ => Admin(); Get["/"] = _ => Admin();
Get["/authentication", true] = async (x, ct) => await Authentication(); Get["/authentication", true] = async (x, ct) => await Authentication();
@ -226,7 +226,7 @@ namespace Ombi.UI.Modules.Admin
Get["/newsletter", true] = async (x, ct) => await Newsletter(); Get["/newsletter", true] = async (x, ct) => await Newsletter();
Post["/newsletter", true] = async (x, ct) => await SaveNewsletter(); Post["/newsletter", true] = async (x, ct) => await SaveNewsletter();
Post["/testnewsletteradminemail"] = x => TestNewsletterAdminEmail(); Post["/testnewsletteradminemail"] = x => TestNewsletterAdminEmail();
Get["/massemail"] = _ => MassEmailView(); Get["/massemail"] = _ => MassEmailView();
Post["/testmassadminemail"] = x => TestMassAdminEmail(); Post["/testmassadminemail"] = x => TestMassAdminEmail();
Post["/sendmassemail"] = x => SendMassEmail(); Post["/sendmassemail"] = x => SendMassEmail();
@ -453,16 +453,16 @@ namespace Ombi.UI.Modules.Admin
{ {
var plexSettings = this.Bind<PlexSettings>(); var plexSettings = this.Bind<PlexSettings>();
if (plexSettings.Enable) if (plexSettings.Enable)
{ {
var valid = this.Validate(plexSettings); var valid = this.Validate(plexSettings);
if (!valid.IsValid) if (!valid.IsValid)
{ {
return Response.AsJson(valid.SendJsonError()); return Response.AsJson(valid.SendJsonError());
} }
} }
if (plexSettings.Enable) if (plexSettings.Enable)
{ {
var embySettings = await EmbySettings.GetSettingsAsync(); var embySettings = await EmbySettings.GetSettingsAsync();
@ -565,9 +565,9 @@ namespace Ombi.UI.Modules.Admin
: new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." }); : new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." });
} }
private Negotiator Sickrage() private Negotiator Sickrage()
{ {
@ -642,9 +642,11 @@ namespace Ombi.UI.Modules.Admin
await NotificationService.Publish(notificationModel, settings); await NotificationService.Publish(notificationModel, settings);
Log.Info("Sent email notification test"); Log.Info("Sent email notification test");
} }
catch (Exception) catch (Exception ex)
{ {
Log.Error("Failed to subscribe and publish test Email Notification"); Log.Error("Failed to subscribe and publish test Email Notification");
var msg = "Failed: " + ex.Message;
return Response.AsJson(new JsonResponseModel { Result = false, Message = msg });
} }
finally finally
{ {
@ -653,7 +655,9 @@ namespace Ombi.UI.Modules.Admin
NotificationService.UnSubscribe(new EmailMessageNotification(EmailService)); NotificationService.UnSubscribe(new EmailMessageNotification(EmailService));
} }
} }
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Email Notification!" }); return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Email Notification!" });
} }
private Response SaveEmailNotifications() private Response SaveEmailNotifications()
@ -832,7 +836,7 @@ namespace Ombi.UI.Modules.Admin
} }
if (!settings.Enabled) if (!settings.Enabled)
{ {
return Response.AsJson(new CouchPotatoProfiles{list = new List<ProfileList>()}); return Response.AsJson(new CouchPotatoProfiles { list = new List<ProfileList>() });
} }
var profiles = CpApi.GetProfiles(settings.FullUri, settings.ApiKey); var profiles = CpApi.GetProfiles(settings.FullUri, settings.ApiKey);
@ -1210,12 +1214,12 @@ namespace Ombi.UI.Modules.Admin
PlexEpisodeCacher = s.PlexEpisodeCacher, PlexEpisodeCacher = s.PlexEpisodeCacher,
PlexUserChecker = s.PlexUserChecker, PlexUserChecker = s.PlexUserChecker,
UserRequestLimitResetter = s.UserRequestLimitResetter, UserRequestLimitResetter = s.UserRequestLimitResetter,
EmbyAvailabilityChecker = s.EmbyAvailabilityChecker, EmbyAvailabilityChecker = s.EmbyAvailabilityChecker,
EmbyContentCacher = s.EmbyContentCacher, EmbyContentCacher = s.EmbyContentCacher,
EmbyEpisodeCacher = s.EmbyEpisodeCacher, EmbyEpisodeCacher = s.EmbyEpisodeCacher,
EmbyUserChecker = s.EmbyUserChecker, EmbyUserChecker = s.EmbyUserChecker,
RadarrCacher = s.RadarrCacher, RadarrCacher = s.RadarrCacher,
WatcherCacher = s.WatcherCacher WatcherCacher = s.WatcherCacher
}; };
return View["SchedulerSettings", model]; return View["SchedulerSettings", model];
} }
@ -1278,7 +1282,7 @@ namespace Ombi.UI.Modules.Admin
var model = this.Bind<NotificationSettingsV2>(); var model = this.Bind<NotificationSettingsV2>();
return View["NotificationSettings", model]; return View["NotificationSettings", model];
} }
private Response TestNewsletterAdminEmail() private Response TestNewsletterAdminEmail()
{ {
try try
@ -1299,7 +1303,8 @@ namespace Ombi.UI.Modules.Admin
{ {
var settings = this.Bind<MassEmailSettings>(); var settings = this.Bind<MassEmailSettings>();
Log.Debug("Clicked Admin Mass Email Test"); Log.Debug("Clicked Admin Mass Email Test");
if (settings.Subject == null) { if (settings.Subject == null)
{
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Please Set a Subject" }); return Response.AsJson(new JsonResponseModel { Result = false, Message = "Please Set a Subject" });
} }
if (settings.Body == null) if (settings.Body == null)

@ -122,8 +122,7 @@ namespace Ombi.UI.Modules.Admin
} }
catch (Exception e) catch (Exception e)
{ {
throw e;
throw;
} }
} }
} }

Loading…
Cancel
Save