aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Notifications/NotificationOptions.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-09-11 15:53:04 -0600
committercrobibero <cody@robibe.ro>2020-09-11 15:53:04 -0600
commitf13b87afa3e81e7fa2710caec58a7d6cb20f7635 (patch)
tree0f269ac5baa27b334c5377d9dec4010aedf25183 /MediaBrowser.Model/Notifications/NotificationOptions.cs
parent2363ad544979adf32207fa927f106fadb784f1fb (diff)
parent6bf0acb854683377bebad3ca27de17706519c420 (diff)
Merge remote-tracking branch 'upstream/master' into api-upload-subtitle
Diffstat (limited to 'MediaBrowser.Model/Notifications/NotificationOptions.cs')
-rw-r--r--MediaBrowser.Model/Notifications/NotificationOptions.cs38
1 files changed, 16 insertions, 22 deletions
diff --git a/MediaBrowser.Model/Notifications/NotificationOptions.cs b/MediaBrowser.Model/Notifications/NotificationOptions.cs
index 9c54bd70e..239a3777e 100644
--- a/MediaBrowser.Model/Notifications/NotificationOptions.cs
+++ b/MediaBrowser.Model/Notifications/NotificationOptions.cs
@@ -1,7 +1,11 @@
+#nullable disable
#pragma warning disable CS1591
using System;
+using Jellyfin.Data.Enums;
+using MediaBrowser.Model.Extensions;
using System.Linq;
+using Jellyfin.Data.Entities;
using MediaBrowser.Model.Users;
namespace MediaBrowser.Model.Notifications
@@ -14,63 +18,53 @@ namespace MediaBrowser.Model.Notifications
{
Options = new[]
{
- new NotificationOption
+ new NotificationOption(NotificationType.TaskFailed.ToString())
{
- Type = NotificationType.TaskFailed.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
- new NotificationOption
+ new NotificationOption(NotificationType.ServerRestartRequired.ToString())
{
- Type = NotificationType.ServerRestartRequired.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
- new NotificationOption
+ new NotificationOption(NotificationType.ApplicationUpdateAvailable.ToString())
{
- Type = NotificationType.ApplicationUpdateAvailable.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
- new NotificationOption
+ new NotificationOption(NotificationType.ApplicationUpdateInstalled.ToString())
{
- Type = NotificationType.ApplicationUpdateInstalled.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
- new NotificationOption
+ new NotificationOption(NotificationType.PluginUpdateInstalled.ToString())
{
- Type = NotificationType.PluginUpdateInstalled.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
- new NotificationOption
+ new NotificationOption(NotificationType.PluginUninstalled.ToString())
{
- Type = NotificationType.PluginUninstalled.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
- new NotificationOption
+ new NotificationOption(NotificationType.InstallationFailed.ToString())
{
- Type = NotificationType.InstallationFailed.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
- new NotificationOption
+ new NotificationOption(NotificationType.PluginInstalled.ToString())
{
- Type = NotificationType.PluginInstalled.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
- new NotificationOption
+ new NotificationOption(NotificationType.PluginError.ToString())
{
- Type = NotificationType.PluginError.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
- new NotificationOption
+ new NotificationOption(NotificationType.UserLockedOut.ToString())
{
- Type = NotificationType.UserLockedOut.ToString(),
Enabled = true,
SendToUserMode = SendToUserType.Admins
}
@@ -113,7 +107,7 @@ namespace MediaBrowser.Model.Notifications
!opt.DisabledMonitorUsers.Contains(userId.ToString(""), StringComparer.OrdinalIgnoreCase);
}
- public bool IsEnabledToSendToUser(string type, string userId, UserPolicy userPolicy)
+ public bool IsEnabledToSendToUser(string type, string userId, User user)
{
NotificationOption opt = GetOptions(type);
@@ -124,7 +118,7 @@ namespace MediaBrowser.Model.Notifications
return true;
}
- if (opt.SendToUserMode == SendToUserType.Admins && userPolicy.IsAdministrator)
+ if (opt.SendToUserMode == SendToUserType.Admins && user.HasPermission(PermissionKind.IsAdministrator))
{
return true;
}