mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
commit
07f5fd0f26
9 changed files with 47 additions and 34 deletions
|
@ -95,7 +95,7 @@ namespace Ombi.Services.Notification
|
|||
if (user.Equals(adminUsername, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Log.Info("This user is the Plex server owner");
|
||||
await PublishUserNotification(userAccount.Username, userAccount.Email, model.Title, model.PosterPath, type);
|
||||
await PublishUserNotification(userAccount.Username, userAccount.Email, model.Title, model.PosterPath, type, model.Type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ namespace Ombi.Services.Notification
|
|||
}
|
||||
|
||||
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);
|
||||
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type, model.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ namespace Ombi.Services.Notification
|
|||
if (user.Equals(adminUsername, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Log.Info("This user is the Plex server owner");
|
||||
await PublishUserNotification(userAccount.Username, userAccount.Email, model.Title, model.PosterPath, type);
|
||||
await PublishUserNotification(userAccount.Username, userAccount.Email, model.Title, model.PosterPath, type, model.Type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ namespace Ombi.Services.Notification
|
|||
}
|
||||
|
||||
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);
|
||||
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type, model.Type);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -159,7 +159,7 @@ namespace Ombi.Services.Notification
|
|||
}
|
||||
}
|
||||
|
||||
private async Task PublishUserNotification(string username, string email, string title, string img, NotificationType type)
|
||||
private async Task PublishUserNotification(string username, string email, string title, string img, NotificationType type, RequestType requestType)
|
||||
{
|
||||
var notificationModel = new NotificationModel
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ namespace Ombi.Services.Notification
|
|||
UserEmail = email,
|
||||
NotificationType = type,
|
||||
Title = title,
|
||||
ImgSrc = img
|
||||
ImgSrc = requestType == RequestType.Movie ? $"https://image.tmdb.org/t/p/w300/{img}" : img
|
||||
};
|
||||
|
||||
// Send the notification to the user.
|
||||
|
|
|
@ -48,21 +48,24 @@ namespace Ombi.Store.Repository
|
|||
public PlexUsers GetUser(string userGuid)
|
||||
{
|
||||
var sql = @"SELECT * FROM PlexUsers
|
||||
WHERE PlexUserId = @UserGuid";
|
||||
WHERE PlexUserId = @UserGuid
|
||||
COLLATE NOCASE";
|
||||
return Db.QueryFirstOrDefault<PlexUsers>(sql, new {UserGuid = userGuid});
|
||||
}
|
||||
|
||||
public PlexUsers GetUserByUsername(string username)
|
||||
{
|
||||
var sql = @"SELECT * FROM PlexUsers
|
||||
WHERE Username = @UserName";
|
||||
WHERE Username = @UserName
|
||||
COLLATE NOCASE";
|
||||
return Db.QueryFirstOrDefault<PlexUsers>(sql, new {UserName = username});
|
||||
}
|
||||
|
||||
public async Task<PlexUsers> GetUserAsync(string userguid)
|
||||
{
|
||||
var sql = @"SELECT * FROM PlexUsers
|
||||
WHERE PlexUserId = @UserGuid";
|
||||
WHERE PlexUserId = @UserGuid
|
||||
COLLATE NOCASE";
|
||||
return await Db.QueryFirstOrDefaultAsync<PlexUsers>(sql, new {UserGuid = userguid});
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ $(function () {
|
|||
});
|
||||
|
||||
// Click TV dropdown option
|
||||
$(document).on("click", ".dropdownTv", function (e) {
|
||||
$(document).on("click", ".requestTv", function (e) {
|
||||
e.preventDefault();
|
||||
var buttonId = e.target.id;
|
||||
if ($("#" + buttonId).attr('disabled')) {
|
||||
|
@ -429,7 +429,8 @@ $(function () {
|
|||
url: result.plexUrl,
|
||||
tvPartialAvailable: result.tvPartialAvailable,
|
||||
disableTvRequestsByEpisode: result.disableTvRequestsByEpisode,
|
||||
disableTvRequestsBySeason: result.disableTvRequestsBySeason
|
||||
disableTvRequestsBySeason: result.disableTvRequestsBySeason,
|
||||
enableTvRequestsForOnlySeries: result.enableTvRequestsForOnlySeries
|
||||
};
|
||||
|
||||
return context;
|
||||
|
|
|
@ -57,5 +57,6 @@ namespace Ombi.UI.Models
|
|||
public bool TvFullyAvailable { get; set; }
|
||||
public bool DisableTvRequestsByEpisode { get; set; }
|
||||
public bool DisableTvRequestsBySeason { get; set; }
|
||||
public bool EnableTvRequestsForOnlySeries { get; set; }
|
||||
}
|
||||
}
|
|
@ -351,7 +351,8 @@ namespace Ombi.UI.Modules
|
|||
NotificationType = NotificationType.Issue,
|
||||
Title = originalRequest.Title,
|
||||
DateTime = DateTime.Now,
|
||||
Body = issue == IssueState.Other ? comment : issue.ToString().ToCamelCaseWords()
|
||||
Body = issue == IssueState.Other ? comment : issue.ToString().ToCamelCaseWords(),
|
||||
ImgSrc = originalRequest.Type == RequestType.Movie ? $"https://image.tmdb.org/t/p/w300/{originalRequest.PosterPath}" : originalRequest.PosterPath
|
||||
};
|
||||
await NotificationService.Publish(model);
|
||||
|
||||
|
|
|
@ -366,7 +366,8 @@ namespace Ombi.UI.Modules
|
|||
SeriesName = t.show.name,
|
||||
Status = t.show.status,
|
||||
DisableTvRequestsByEpisode = prSettings.DisableTvRequestsByEpisode,
|
||||
DisableTvRequestsBySeason = prSettings.DisableTvRequestsBySeason
|
||||
DisableTvRequestsBySeason = prSettings.DisableTvRequestsBySeason,
|
||||
EnableTvRequestsForOnlySeries = (prSettings.DisableTvRequestsByEpisode && prSettings.DisableTvRequestsBySeason)
|
||||
};
|
||||
|
||||
|
||||
|
@ -1276,7 +1277,8 @@ namespace Ombi.UI.Modules
|
|||
User = Username,
|
||||
DateTime = DateTime.Now,
|
||||
NotificationType = NotificationType.NewRequest,
|
||||
RequestType = model.Type
|
||||
RequestType = model.Type,
|
||||
ImgSrc = model.Type == RequestType.Movie ? $"https://image.tmdb.org/t/p/w300/{model.PosterPath}" : model.PosterPath
|
||||
};
|
||||
await NotificationService.Publish(notificationModel);
|
||||
}
|
||||
|
@ -1314,7 +1316,8 @@ namespace Ombi.UI.Modules
|
|||
User = Username,
|
||||
DateTime = DateTime.Now,
|
||||
NotificationType = NotificationType.NewRequest,
|
||||
RequestType = model.Type
|
||||
RequestType = model.Type,
|
||||
ImgSrc = model.Type == RequestType.Movie ? $"https://image.tmdb.org/t/p/w300/{model.PosterPath}" : model.PosterPath
|
||||
};
|
||||
await NotificationService.Publish(notificationModel);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<div class="col-sm-8 col-sm-push-1">
|
||||
<form class="form-horizontal" method="POST" id="mainForm">
|
||||
<fieldset>
|
||||
<legend>Plex Request Settings</legend>
|
||||
<legend>Ombi Configuration</legend>
|
||||
<div class="form-group">
|
||||
<label for="portNumber" class="control-label">Port</label>
|
||||
|
||||
|
|
|
@ -175,23 +175,27 @@
|
|||
@*//TODO Not used yet*@
|
||||
<button style="text-align: right" class="btn btn-success-outline disabled" disabled><i class="fa fa-check"></i> @UI.Search_Available</button><br />
|
||||
{{else}}
|
||||
<div class="dropdown">
|
||||
<button id="{{id}}" class="btn {{#if available}}btn-success-outline{{else}}btn-primary-outline{{/if}} dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<i class="fa fa-plus"></i> {{#if available}}@UI.Search_Available{{else}}@UI.Search_Request {{/if}}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li><a id="{{id}}" season-select="0" class="dropdownTv " href="#">@UI.Search_AllSeasons</a></li>
|
||||
{{#if_eq disableTvRequestsBySeason false}}
|
||||
<li><a id="{{id}}" season-select="1" class="dropdownTv" href="#">@UI.Search_FirstSeason</a></li>
|
||||
<li><a id="{{id}}" season-select="2" class="dropdownTv" href="#">@UI.Search_LatestSeason</a></li>
|
||||
<li><a id="SeasonSelect" data-identifier="{{id}}" data-toggle="modal" data-target="#seasonsModal" href="#">@UI.Search_SelectSeason...</a></li>
|
||||
{{/if_eq}}
|
||||
{{#if_eq disableTvRequestsByEpisode false}}
|
||||
<li><a id="EpisodeSelect" data-identifier="{{id}}" data-toggle="modal" data-target="#episodesModal" href="#">@UI.Search_SelectEpisode...</a></li>
|
||||
{{/if_eq}}
|
||||
</ul>
|
||||
</div>
|
||||
{{#if_eq enableTvRequestsForOnlySeries true}}
|
||||
<button id="{{id}}" style="text-align: right" class="btn {{#if available}}btn-success-outline{{else}}btn-primary-outline{{/if}} btn-primary-outline requestTv" season-select="0" type="button"><i class="fa fa-plus"></i> @UI.Search_Request</button>
|
||||
{{else}}
|
||||
<div class="dropdown">
|
||||
<button id="{{id}}" class="btn {{#if available}}btn-success-outline{{else}}btn-primary-outline{{/if}} dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<i class="fa fa-plus"></i> {{#if available}}@UI.Search_Available{{else}}@UI.Search_Request {{/if}}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li><a id="{{id}}" season-select="0" class="dropdownTv " href="#">@UI.Search_AllSeasons</a></li>
|
||||
{{#if_eq disableTvRequestsBySeason false}}
|
||||
<li><a id="{{id}}" season-select="1" class="dropdownTv" href="#">@UI.Search_FirstSeason</a></li>
|
||||
<li><a id="{{id}}" season-select="2" class="dropdownTv" href="#">@UI.Search_LatestSeason</a></li>
|
||||
<li><a id="SeasonSelect" data-identifier="{{id}}" data-toggle="modal" data-target="#seasonsModal" href="#">@UI.Search_SelectSeason...</a></li>
|
||||
{{/if_eq}}
|
||||
{{#if_eq disableTvRequestsByEpisode false}}
|
||||
<li><a id="EpisodeSelect" data-identifier="{{id}}" data-toggle="modal" data-target="#episodesModal" href="#">@UI.Search_SelectEpisode...</a></li>
|
||||
{{/if_eq}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if_eq}}
|
||||
{{#if available}}
|
||||
<br />
|
||||
<a style="text-align: right" class="btn btn-sm btn-primary-outline" href="{{url}}" target="_blank"><i class="fa fa-eye"></i> @UI.Search_ViewInPlex</a>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="col-lg-3 col-md-3 col-sm-4">
|
||||
<div class="list-group table-of-contents">
|
||||
@Html.GetSidebarUrl(Context, "/admin/about", "About")
|
||||
@Html.GetSidebarUrl(Context, "/admin", "Plex Request")
|
||||
@Html.GetSidebarUrl(Context, "/admin", "Ombi Configuration")
|
||||
@Html.GetSidebarUrl(Context, "/admin/customization", "Customization")
|
||||
@Html.GetSidebarUrl(Context, "/admin/landingpage", "Landing Page")
|
||||
@Html.GetSidebarUrl(Context, "/admin/authentication", "Authentication")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue