mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
commit
f1928ebf6f
4 changed files with 64 additions and 15 deletions
|
@ -87,8 +87,7 @@ namespace Ombi.Services.Notification
|
|||
selectedUsers.Add(requestUser);
|
||||
}
|
||||
}
|
||||
|
||||
//var selectedUsers = users.Select(x => x.Username).Intersect(model.RequestedUsers, StringComparer.CurrentCultureIgnoreCase);
|
||||
|
||||
foreach (var user in selectedUsers)
|
||||
{
|
||||
Log.Info("Notifying user {0}", user);
|
||||
|
@ -99,16 +98,39 @@ namespace Ombi.Services.Notification
|
|||
return;
|
||||
}
|
||||
|
||||
var email = plexUser.User.FirstOrDefault(x => x.Username.Equals(user, StringComparison.CurrentCultureIgnoreCase));
|
||||
if (string.IsNullOrEmpty(email?.Email))
|
||||
{
|
||||
Log.Info("There is no email address for this Plex user, cannot send notification");
|
||||
// We do not have a plex user that requested this!
|
||||
continue;
|
||||
}
|
||||
var localUser =
|
||||
users.FirstOrDefault( x =>
|
||||
x.Username.Equals(user, StringComparison.CurrentCultureIgnoreCase) ||
|
||||
x.UserAlias.Equals(user, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", email.Username, email.Email, model.Title);
|
||||
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type, model.Type);
|
||||
// So if the request was from an alias, then we need to use the local user (since that contains the alias).
|
||||
// If we do not have a local user, then we should be using the Plex user if that user exists.
|
||||
// This will execute most of the time since Plex and Local users will most always be in the database.
|
||||
if (localUser != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(localUser?.EmailAddress))
|
||||
{
|
||||
Log.Info("There is no email address for this Local user ({0}), cannot send notification", localUser.Username);
|
||||
continue;
|
||||
}
|
||||
|
||||
Log.Info("Sending notification to: {0} at: {1}, for : {2}", localUser, localUser.EmailAddress, model.Title);
|
||||
await PublishUserNotification(localUser.Username, localUser.EmailAddress, model.Title, model.PosterPath, type, model.Type);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var email = plexUser.User.FirstOrDefault(x => x.Username.Equals(user, StringComparison.CurrentCultureIgnoreCase));
|
||||
if (string.IsNullOrEmpty(email?.Email))
|
||||
{
|
||||
Log.Info("There is no email address for this Plex user ({0}), cannot send notification", email?.Username);
|
||||
// We do not have a plex user that requested this!
|
||||
continue;
|
||||
}
|
||||
|
||||
Log.Info("Sending notification to: {0} at: {1}, for : {2}", email.Username, email.Email, model.Title);
|
||||
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type, model.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ var base = $('#baseUrl').text();
|
|||
var tvLoaded = false;
|
||||
var albumLoaded = false;
|
||||
|
||||
var isAdmin = $('#isAdmin').val();
|
||||
var isAdmin = $('#isAdmin').text();
|
||||
var defaultFiler = isAdmin == 'True' ? '.approved-fase' : 'all';
|
||||
|
||||
var mixItUpDefault = {
|
||||
|
@ -30,6 +30,26 @@ var mixItUpDefault = {
|
|||
},
|
||||
callbacks: {
|
||||
onMixStart: function (state, futureState) {
|
||||
//futureState.activeSort // sort
|
||||
//futureState.activeFilter // next filter
|
||||
|
||||
// The below is TODO for saving the users filter and sort order
|
||||
//var url = createBaseUrl(base, '/requests/UpdateFilters');
|
||||
//$.ajax({
|
||||
// type: 'post',
|
||||
// url: url,
|
||||
// data: {sort:futureState.activeSort, filter:futureState.activeFilte},
|
||||
// dataType: "json",
|
||||
// success: function (response) {
|
||||
// console.log("saved filter and sort order");
|
||||
// },
|
||||
// error: function (e) {
|
||||
// console.log(e);
|
||||
// generateNotify("Something went wrong saving your filter!", "danger");
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
$('.mix', this).removeAttr('data-bound').removeData('bound'); // fix for animation issues in other tabs
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,8 @@ namespace Ombi.UI.Modules
|
|||
Post["/clearissues", true] = async (x, ct) => await ClearIssue((int)Request.Form.Id);
|
||||
|
||||
Post["/changeavailability", true] = async (x, ct) => await ChangeRequestAvailability((int)Request.Form.Id, (bool)Request.Form.Available);
|
||||
|
||||
Post["/UpdateFilters", true] = async (x, ct) => await UpdateFilters();
|
||||
}
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
@ -388,7 +390,7 @@ namespace Ombi.UI.Modules
|
|||
{
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Sorry, you do not have the correct permissions to change a request." });
|
||||
}
|
||||
|
||||
|
||||
Analytics.TrackEventAsync(Category.Requests, Action.Update, available ? "Make request available" : "Make request unavailable", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||
var originalRequest = await Service.GetAsync(requestId);
|
||||
if (originalRequest == null)
|
||||
|
@ -406,6 +408,11 @@ namespace Ombi.UI.Modules
|
|||
: new { Result = false, Available = false, Message = "Could not update the availability, please try again or check the logs" });
|
||||
}
|
||||
|
||||
|
||||
private async Task<Response> UpdateFilters()
|
||||
{
|
||||
|
||||
|
||||
return Response.AsJson("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
}
|
||||
}
|
||||
<div>
|
||||
<div hidden="hidden" id="isAdmin" value="@isAdmin"></div>
|
||||
<div hidden="hidden" id="isAdmin" >@isAdmin</div>
|
||||
<h1>@UI.Requests_Title</h1>
|
||||
<h4>@UI.Requests_Paragraph</h4>
|
||||
<br/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue