mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
add an option to stop sending notifications for requests that don't require approval #345
This commit is contained in:
parent
4e10acbb51
commit
96f27f8f1a
5 changed files with 1595 additions and 1579 deletions
|
@ -45,6 +45,7 @@ namespace PlexRequests.Core.SettingModels
|
|||
public int WeeklyRequestLimit { get; set; }
|
||||
public string NoApprovalUsers { get; set; }
|
||||
public bool CollectAnalyticData { get; set; }
|
||||
public bool IgnoreNotifyForAutoApprovedRequests { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The CSS name of the theme we want
|
||||
|
|
|
@ -488,7 +488,7 @@ namespace PlexRequests.UI.Modules
|
|||
Log.Info("Adding movie to database (No approval required)");
|
||||
await RequestService.AddRequestAsync(model);
|
||||
|
||||
if (ShouldSendNotification())
|
||||
if (ShouldSendNotification(settings))
|
||||
{
|
||||
var notificationModel = new NotificationModel
|
||||
{
|
||||
|
@ -515,7 +515,7 @@ namespace PlexRequests.UI.Modules
|
|||
Log.Info("Adding movie to database (No approval required)");
|
||||
await RequestService.AddRequestAsync(model);
|
||||
|
||||
if (ShouldSendNotification())
|
||||
if (ShouldSendNotification(settings))
|
||||
{
|
||||
var notificationModel = new NotificationModel
|
||||
{
|
||||
|
@ -663,7 +663,7 @@ namespace PlexRequests.UI.Modules
|
|||
Log.Debug("Adding tv to database requests (No approval required & Sonarr)");
|
||||
await RequestService.AddRequestAsync(model);
|
||||
|
||||
if (ShouldSendNotification())
|
||||
if (ShouldSendNotification(settings))
|
||||
{
|
||||
var notify1 = new NotificationModel
|
||||
{
|
||||
|
@ -691,7 +691,7 @@ namespace PlexRequests.UI.Modules
|
|||
model.Approved = true;
|
||||
Log.Debug("Adding tv to database requests (No approval required & SickRage)");
|
||||
await RequestService.AddRequestAsync(model);
|
||||
if (ShouldSendNotification())
|
||||
if (ShouldSendNotification(settings))
|
||||
{
|
||||
var notify2 = new NotificationModel
|
||||
{
|
||||
|
@ -713,7 +713,7 @@ namespace PlexRequests.UI.Modules
|
|||
model.Approved = true;
|
||||
Log.Debug("Adding tv to database requests (No approval required) and Sonarr/Sickrage not setup");
|
||||
await RequestService.AddRequestAsync(model);
|
||||
if (ShouldSendNotification())
|
||||
if (ShouldSendNotification(settings))
|
||||
{
|
||||
var notify2 = new NotificationModel
|
||||
{
|
||||
|
@ -739,9 +739,9 @@ namespace PlexRequests.UI.Modules
|
|||
return Response.AsJson(new JsonResponseModel { Result = true, Message = $"{fullShowName} was successfully added!" });
|
||||
}
|
||||
|
||||
private bool ShouldSendNotification()
|
||||
private bool ShouldSendNotification(PlexRequestSettings prSettings)
|
||||
{
|
||||
var sendNotification = true;
|
||||
var sendNotification = !prSettings.IgnoreNotifyForAutoApprovedRequests;
|
||||
var claims = Context.CurrentUser?.Claims;
|
||||
if (claims != null)
|
||||
{
|
||||
|
@ -838,7 +838,7 @@ namespace PlexRequests.UI.Modules
|
|||
model.Approved = true;
|
||||
await RequestService.AddRequestAsync(model);
|
||||
|
||||
if (ShouldSendNotification())
|
||||
if (ShouldSendNotification(settings))
|
||||
{
|
||||
var notify2 = new NotificationModel
|
||||
{
|
||||
|
@ -858,7 +858,7 @@ namespace PlexRequests.UI.Modules
|
|||
});
|
||||
}
|
||||
|
||||
if (ShouldSendNotification())
|
||||
if (ShouldSendNotification(settings))
|
||||
{
|
||||
var notify2 = new NotificationModel
|
||||
{
|
||||
|
|
|
@ -194,6 +194,21 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.IgnoreNotifyForAutoApprovedRequests)
|
||||
{
|
||||
<input type="checkbox" id="IgnoreNotifyForAutoApprovedRequests" name="IgnoreNotifyForAutoApprovedRequests" checked="checked">
|
||||
<label for="IgnoreNotifyForAutoApprovedRequests">Do not send notifications for requests that don't require approval</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="IgnoreNotifyForAutoApprovedRequests" name="IgnoreNotifyForAutoApprovedRequests"><label for="IgnoreNotifyForAutoApprovedRequests">Do not send notifications for requests that don't require approval</label>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue