mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 15:32:37 -07:00
#54 comma separated list of users who don't require approval + fix a couple request messages (include show title)
This commit is contained in:
parent
63e4e29051
commit
fff267db37
3 changed files with 39 additions and 4 deletions
|
@ -24,6 +24,10 @@
|
||||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace PlexRequests.Core.SettingModels
|
namespace PlexRequests.Core.SettingModels
|
||||||
{
|
{
|
||||||
public class PlexRequestSettings : Settings
|
public class PlexRequestSettings : Settings
|
||||||
|
@ -35,5 +39,27 @@ namespace PlexRequests.Core.SettingModels
|
||||||
public bool RequireMovieApproval { get; set; }
|
public bool RequireMovieApproval { get; set; }
|
||||||
public bool RequireTvShowApproval { get; set; }
|
public bool RequireTvShowApproval { get; set; }
|
||||||
public int WeeklyRequestLimit { get; set; }
|
public int WeeklyRequestLimit { get; set; }
|
||||||
|
public string NoApprovalUsers { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public List<string> NoApprovalUserList
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var users = new List<string>();
|
||||||
|
if (string.IsNullOrEmpty(NoApprovalUsers))
|
||||||
|
{
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
|
||||||
|
var splitUsers = NoApprovalUsers.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
foreach (var user in splitUsers)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(user))
|
||||||
|
users.Add(user.Trim());
|
||||||
|
}
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,7 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
var settings = PrService.GetSettings();
|
var settings = PrService.GetSettings();
|
||||||
Log.Trace(settings.DumpJson());
|
Log.Trace(settings.DumpJson());
|
||||||
if (!settings.RequireMovieApproval)
|
if (!settings.RequireMovieApproval || settings.NoApprovalUserList.Any(x => x.Equals(Session[SessionKeys.UsernameKey].ToString(), StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
var cpSettings = CpService.GetSettings();
|
var cpSettings = CpService.GetSettings();
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ namespace PlexRequests.UI.Modules
|
||||||
};
|
};
|
||||||
NotificationService.Publish(notificationModel);
|
NotificationService.Publish(notificationModel);
|
||||||
|
|
||||||
return Response.AsJson(new JsonResponseModel {Result = true});
|
return Response.AsJson(new JsonResponseModel {Result = true, Message = $"{fullMovieName} was successfully added!" });
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
Response.AsJson(new JsonResponseModel
|
Response.AsJson(new JsonResponseModel
|
||||||
|
@ -272,7 +272,7 @@ namespace PlexRequests.UI.Modules
|
||||||
};
|
};
|
||||||
NotificationService.Publish(notificationModel);
|
NotificationService.Publish(notificationModel);
|
||||||
|
|
||||||
return Response.AsJson(new JsonResponseModel { Result = true });
|
return Response.AsJson(new JsonResponseModel { Result = true, Message = $"{fullMovieName} was successfully added!" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ namespace PlexRequests.UI.Modules
|
||||||
model.SeasonList = seasonsList.ToArray();
|
model.SeasonList = seasonsList.ToArray();
|
||||||
|
|
||||||
var settings = PrService.GetSettings();
|
var settings = PrService.GetSettings();
|
||||||
if (!settings.RequireTvShowApproval)
|
if (!settings.RequireTvShowApproval || settings.NoApprovalUserList.Any(x => x.Equals(Session[SessionKeys.UsernameKey].ToString(), StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
var sonarrSettings = SonarrService.GetSettings();
|
var sonarrSettings = SonarrService.GetSettings();
|
||||||
var sender = new TvSender(SonarrApi, SickrageApi);
|
var sender = new TvSender(SonarrApi, SickrageApi);
|
||||||
|
|
|
@ -83,6 +83,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p class="form-group">A comma separated list of users whose requests do not require approval.</p>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="noApprovalUsers" class="control-label">Users</label>
|
||||||
|
<div>
|
||||||
|
<input type="text" class="form-control-custom form-control " id="NoApprovalUsers" name="NoApprovalUsers" placeholder="e.g. John, Bobby" value="@Model.NoApprovalUsers">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
|
||||||
@*<div class="form-group">
|
@*<div class="form-group">
|
||||||
<label for="WeeklyRequestLimit" class="control-label">Weekly Request Limit</label>
|
<label for="WeeklyRequestLimit" class="control-label">Weekly Request Limit</label>
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue