Merge branch 'feature/v4' of https://github.com/tidusjar/Ombi into feature/v4

pull/3689/head
tidusjar 4 years ago
commit b3de7374e1

@ -53,9 +53,11 @@ namespace Ombi.Notifications.Agents
_logger.LogInformation($"Template {NotificationType.NewRequest} is disabled for {NotificationAgent.Mobile}");
return;
}
var notification = new NotificationMessage
{
Message = parsed.Message,
Data = GetNotificationData(parsed, NotificationType.NewRequest)
};
// Get admin devices
@ -74,6 +76,7 @@ namespace Ombi.Notifications.Agents
var notification = new NotificationMessage
{
Message = parsed.Message,
Data = GetNotificationData(parsed, NotificationType.Issue)
};
// Get admin devices
@ -92,6 +95,7 @@ namespace Ombi.Notifications.Agents
var notification = new NotificationMessage
{
Message = parsed.Message,
Data = GetNotificationData(parsed, NotificationType.IssueComment)
};
if (model.Substitutes.TryGetValue("AdminComment", out var isAdminString))
{
@ -123,6 +127,7 @@ namespace Ombi.Notifications.Agents
var notification = new NotificationMessage
{
Message = parsed.Message,
Data = GetNotificationData(parsed, NotificationType.IssueResolved)
};
// Send to user
@ -144,6 +149,7 @@ namespace Ombi.Notifications.Agents
var notification = new NotificationMessage
{
Message = parsed.Message,
Data = GetNotificationData(parsed, NotificationType.ItemAddedToFaultQueue)
};
// Get admin devices
@ -162,6 +168,7 @@ namespace Ombi.Notifications.Agents
var notification = new NotificationMessage
{
Message = parsed.Message,
Data = GetNotificationData(parsed, NotificationType.RequestDeclined)
};
// Send to user
@ -181,6 +188,7 @@ namespace Ombi.Notifications.Agents
var notification = new NotificationMessage
{
Message = parsed.Message,
Data = GetNotificationData(parsed, NotificationType.RequestApproved)
};
// Send to user
@ -198,9 +206,13 @@ namespace Ombi.Notifications.Agents
_logger.LogInformation($"Template {NotificationType.RequestAvailable} is disabled for {NotificationAgent.Mobile}");
return;
}
var data = GetNotificationData(parsed, NotificationType.RequestAvailable);
var notification = new NotificationMessage
{
Message = parsed.Message,
Data = data
};
// Send to user
var playerIds = GetUsers(model, NotificationType.RequestAvailable);
@ -208,6 +220,14 @@ namespace Ombi.Notifications.Agents
await AddSubscribedUsers(playerIds);
await Send(playerIds, notification, settings, model);
}
private static Dictionary<string,string> GetNotificationData(NotificationMessageContent parsed, NotificationType type)
{
var notificationData = parsed.Data.ToDictionary(x => x.Key, x => x.Value);
notificationData[nameof(NotificationType)] = type.ToString();
return notificationData;
}
protected override Task Send(NotificationMessage model, MobileNotificationSettings settings)
{
throw new NotImplementedException();
@ -225,7 +245,8 @@ namespace Ombi.Notifications.Agents
{
Body = model.Message,
Title = model.Subject,
To = token
To = token,
Data = new Dictionary<string, string>(model.Data)
});
}

@ -14,12 +14,12 @@ namespace Ombi.Notifications
{
public class NotificationMessageCurlys
{
public void Setup(NotificationOptions opts, FullBaseRequest req, CustomizationSettings s, UserNotificationPreferences pref)
public void Setup(NotificationOptions opts, MovieRequests req, CustomizationSettings s, UserNotificationPreferences pref)
{
LoadIssues(opts);
RequestId = req?.Id.ToString();
ProviderId = req?.TheMovieDbId.ToString() ?? string.Empty;
string title;
if (req == null)
{
@ -73,6 +73,7 @@ namespace Ombi.Notifications
LoadIssues(opts);
RequestId = req?.Id.ToString();
ProviderId = req?.ForeignArtistId ?? string.Empty;
string title;
if (req == null)
@ -122,6 +123,7 @@ namespace Ombi.Notifications
{
LoadIssues(opts);
RequestId = req.Id.ToString();
ProviderId = req?.ParentRequest?.TvDbId.ToString() ?? string.Empty;
string title;
if (req == null)
{
@ -274,6 +276,7 @@ namespace Ombi.Notifications
public string DenyReason { get; set; }
public string AvailableDate { get; set; }
public string RequestStatus { get; set; }
public string ProviderId { get; set; }
// System Defined
private string LongDate => DateTime.Now.ToString("D");
@ -312,6 +315,7 @@ namespace Ombi.Notifications
{nameof(DenyReason),DenyReason},
{nameof(AvailableDate),AvailableDate},
{nameof(RequestStatus),RequestStatus},
{nameof(ProviderId),ProviderId},
};
}
}

@ -3,7 +3,7 @@ using System.Threading.Tasks;
namespace Ombi.Core.Settings
{
public interface ISettingsService<T> : IDisposable
public interface ISettingsService<T>
{
T GetSettings();
Task<T> GetSettingsAsync();

@ -155,24 +155,5 @@ namespace Ombi.Settings.Settings
return settings.Content;
//return _protector.Unprotect(settings.Content);
}
private bool _disposed;
protected virtual void Dispose(bool disposing)
{
if (_disposed)
return;
if (disposing)
{
Repo?.Dispose();
}
_disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}

@ -5,7 +5,7 @@ using Ombi.Store.Entities;
namespace Ombi.Store.Repository
{
public interface ISettingsRepository : IDisposable
public interface ISettingsRepository
{
/// <summary>
/// Inserts the specified entity.

@ -121,24 +121,5 @@ namespace Ombi.Store.Repository
return r;
}
}
private bool _disposed;
protected virtual void Dispose(bool disposing)
{
if (_disposed)
return;
if (disposing)
{
Db?.Dispose();
}
_disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}

@ -46,7 +46,7 @@ export class MyNavComponent implements OnInit {
{ name: "NavigationBar.Requests", icon: "list", link: "/requests-list", requiresAdmin: false, enabled: true },
{ name: "NavigationBar.Issues", icon: "notification_important", link: "/issues", requiresAdmin: false, enabled: this.issuesEnabled },
{ name: "NavigationBar.UserManagement", icon: "account_circle", link: "/usermanagement", requiresAdmin: true, enabled: true },
{ name: "NavigationBar.Calendar", icon: "calendar_today", link: "/calendar", requiresAdmin: false, enabled: true },
// { name: "NavigationBar.Calendar", icon: "calendar_today", link: "/calendar", requiresAdmin: false, enabled: true },
{ name: "NavigationBar.Donate", icon: "attach_money", link: "https://www.paypal.me/PlexRequestsNet", donation: true, requiresAdmin: true, enabled: true, toolTip: true, style: "color:red;", toolTipMessage: 'NavigationBar.DonateTooltip' },
{ name: "NavigationBar.Settings", icon: "settings", link: "/Settings/About", requiresAdmin: true, enabled: true },
{ name: "NavigationBar.UserPreferences", icon: "person", link: "/user-preferences", requiresAdmin: false, enabled: true },

@ -118,28 +118,18 @@ export class UserManagementUserComponent implements OnInit {
}
public delete() {
// TODO
// this.confirmationService.confirm({
// message: "Are you sure that you want to delete this user? If this user has any requests they will also be deleted.",
// header: "Are you sure?",
// icon: "fa fa-trash",
// accept: () => {
// this.identityService.deleteUser(this.user).subscribe(x => {
// if (x.successful) {
// this.notificationService.send(`The user ${this.user.userName} was deleted`);
// this.router.navigate(["usermanagement"]);
// } else {
// x.errors.forEach((val) => {
// this.notificationService.send(val);
// });
// }
// });
// },
// reject: () => {
// return;
// },
// });
this.identityService.deleteUser(this.user).subscribe(x => {
if (x.successful) {
this.notificationService.send(`The user ${this.user.userName} was deleted`);
this.router.navigate(["usermanagement"]);
} else {
x.errors.forEach((val) => {
this.notificationService.send(val);
});
}
});
}
public resetPassword() {

@ -35,7 +35,7 @@ export class UserManagementComponent implements OnInit {
public async ngOnInit() {
this.users = await this.identityService.getUsers().toPromise();
this.dataSource = new MatTableDataSource(this.users);
this.dataSource.sort = this.sort;

@ -40,6 +40,7 @@
<link href="styles/please-wait.css" rel="stylesheet">
<link href="styles/spinkit.css" rel="stylesheet">
<link href="styles/11-folding-cube.css" rel="stylesheet">
<link rel="icon" type="image/png" href="/images/favicon/favicon.ico"/>
<script src="styles/please-wait.js"></script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

@ -57,7 +57,7 @@
"Vote": "Vote",
"Donate": "Donate!",
"DonateLibraryMaintainer": "Donate to Library Maintainer",
"DonateTooltip": "This is how I convince my wife to let me spend my spare time developing Ombi ;)",
"DonateTooltip": "This is how I convince my wife to let me spend my spare time developing Ombi 😁",
"UpdateAvailableTooltip": "Update Available!",
"Settings": "Settings",
"Welcome": "Welcome {{username}}",

Loading…
Cancel
Save