mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 14:10:50 -07:00
Some general improvements
This commit is contained in:
parent
a8dd6905fd
commit
a1eb944f83
7 changed files with 31 additions and 53 deletions
|
@ -34,7 +34,6 @@ namespace Ombi.Core.SettingModels
|
|||
public string EmailSender { get; set; }
|
||||
public string EmailUsername { get; set; }
|
||||
public bool Authentication { get; set; }
|
||||
public bool EnableUserEmailNotifications { get; set; }
|
||||
public string RecipientEmail { get; set; }
|
||||
}
|
||||
}
|
|
@ -66,7 +66,15 @@ namespace Ombi.Services.Jobs
|
|||
var movies = RadarrApi.GetMovies(settings.ApiKey, settings.FullUri);
|
||||
if (movies != null)
|
||||
{
|
||||
var movieIds = movies.Select(x => x.tmdbId).ToList();
|
||||
var movieIds = new List<int>();
|
||||
foreach (var m in movies)
|
||||
{
|
||||
if (m.tmdbId > 0)
|
||||
{
|
||||
movieIds.Add(m.tmdbId);
|
||||
}
|
||||
}
|
||||
//var movieIds = movies.Select(x => x.tmdbId).ToList();
|
||||
Cache.Set(CacheKeys.RadarrMovies, movieIds, CacheKeys.TimeFrameMinutes.SchedulerCaching);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,14 +119,6 @@ namespace Ombi.Services.Notification
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!settings.EnableUserEmailNotifications)
|
||||
{
|
||||
if (!settings.Enabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -237,10 +229,6 @@ namespace Ombi.Services.Notification
|
|||
|
||||
private async Task EmailAvailableRequest(NotificationModel model, EmailNotificationSettings settings)
|
||||
{
|
||||
if (!settings.EnableUserEmailNotifications)
|
||||
{
|
||||
await Task.FromResult(false);
|
||||
}
|
||||
var email = new EmailBasicTemplate();
|
||||
var html = email.LoadTemplate(
|
||||
$"Ombi: {model.Title} is now available!",
|
||||
|
|
|
@ -211,8 +211,8 @@ namespace Ombi.UI.Modules.Admin
|
|||
Get["/headphones"] = _ => Headphones();
|
||||
Post["/headphones"] = _ => SaveHeadphones();
|
||||
|
||||
Get["/newsletter"] = _ => Newsletter();
|
||||
Post["/newsletter"] = _ => SaveNewsletter();
|
||||
Get["/newsletter", true] = async (x, ct) => await Newsletter();
|
||||
Post["/newsletter", true] = async (x, ct) => await SaveNewsletter();
|
||||
|
||||
Post["/createapikey"] = x => CreateApiKey();
|
||||
|
||||
|
@ -845,13 +845,13 @@ namespace Ombi.UI.Modules.Admin
|
|||
: new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." });
|
||||
}
|
||||
|
||||
private Negotiator Newsletter()
|
||||
private async Task<Negotiator> Newsletter()
|
||||
{
|
||||
var settings = NewsLetterService.GetSettings();
|
||||
var settings = await NewsLetterService.GetSettingsAsync();
|
||||
return View["NewsletterSettings", settings];
|
||||
}
|
||||
|
||||
private Response SaveNewsletter()
|
||||
private async Task<Response> SaveNewsletter()
|
||||
{
|
||||
var settings = this.Bind<NewletterSettings>();
|
||||
|
||||
|
@ -859,9 +859,17 @@ namespace Ombi.UI.Modules.Admin
|
|||
if (!valid.IsValid)
|
||||
{
|
||||
var error = valid.SendJsonError();
|
||||
Log.Info("Error validating Headphones settings, message: {0}", error.Message);
|
||||
Log.Info("Error validating Newsletter settings, message: {0}", error.Message);
|
||||
return Response.AsJson(error);
|
||||
}
|
||||
|
||||
// Make sure emails are setup
|
||||
var emailSettings = await EmailService.GetSettingsAsync();
|
||||
if (!emailSettings.Enabled)
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Please enable your email notifications" });
|
||||
}
|
||||
|
||||
settings.SendRecentlyAddedEmail = settings.SendRecentlyAddedEmail;
|
||||
var result = NewsLetterService.SaveSettings(settings);
|
||||
|
||||
|
|
|
@ -31,20 +31,7 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.EnableUserEmailNotifications)
|
||||
{
|
||||
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications" checked="checked"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="EnableUserEmailNotifications" name="EnableUserEmailNotifications"><label for="EnableUserEmailNotifications">Enable user email notifications</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
|
@ -59,7 +46,7 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<small>Please note that if user notifications is enabled, the email will get sent with the SMTP set-up below.</small>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="EmailHost" class="control-label">SMTP Host name or IP</label>
|
||||
<div class="">
|
||||
|
@ -82,12 +69,15 @@
|
|||
<input type="text" class="form-control form-control-custom " id="EmailSender" name="EmailSender" value="@Model.EmailSender">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<small>The sender is who the email will be sent from, this can be for any email including user notification emails (if that is enabled).</small>
|
||||
<div class="form-group">
|
||||
<label for="RecipientEmail" class="control-label">Email Recipient</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " id="RecipientEmail" name="RecipientEmail" value="@Model.RecipientEmail">
|
||||
</div>
|
||||
</div>
|
||||
<small>The recipient email is used for emails going to the administrator.</small>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -16,35 +16,20 @@
|
|||
<br />
|
||||
@if (Model.SendRecentlyAddedEmail)
|
||||
{
|
||||
<input type="checkbox" id="SendRecentlyAddedEmail" name="SendRecentlyAddedEmail" checked="checked"><label for="SendRecentlyAddedEmail">Enable the newsletter of recently added content</label>
|
||||
<input type="checkbox" id="SendRecentlyAddedEmail" name="SendRecentlyAddedEmail" checked="checked"><label for="SendRecentlyAddedEmail">Enable newsletter</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="SendRecentlyAddedEmail" name="SendRecentlyAddedEmail"><label for="SendRecentlyAddedEmail">Enable the newsletter of recently added content</label>
|
||||
<input type="checkbox" id="SendRecentlyAddedEmail" name="SendRecentlyAddedEmail"><label for="SendRecentlyAddedEmail">Enable newslette</label>
|
||||
}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
@if (Model.SendToPlexUsers)
|
||||
{
|
||||
<input type="checkbox" id="SendToPlexUsers" name="SendToPlexUsers" checked="checked"><label for="SendToPlexUsers">Send to all of your Plex 'Friends'</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="SendToPlexUsers" name="SendToPlexUsers"><label for="SendToPlexUsers">Send to all of your Plex 'Friends'</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<label for="CustomUsers" class="control-label">Email Addresses to Send to (For users that are not in your Plex Friends)</label>
|
||||
<label for="CustomUsers" class="control-label">Email Addresses to Send to (For users that are not in your User Management section)</label>
|
||||
<small>You can add multiple email address by using the ; delimiter</small>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " placeholder="first@address.com;second@address.com" id="CustomUsers" name="CustomUsers" value="@Model.CustomUsers">
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
@Html.Checkbox(Model.Settings.NewSearch, "NewSearch", "Use New Search")
|
||||
|
||||
<div class="form-group">
|
||||
<label for="lang" class="control-label">Default Language</label>
|
||||
|
@ -105,6 +104,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
@Html.Checkbox(Model.Settings.NewSearch, "NewSearch", "Use New Search")
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button type="submit" id="save" class="btn btn-primary-outline">Submit</button>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue