aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Notifications
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-09-19 22:06:56 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-09-19 22:06:56 -0400
commit718545a79b0ba8709609b176ebb3922d6fa8eb6d (patch)
tree1d5283619ffbf5146b7bd9b6c6037c57d3eabb13 /MediaBrowser.Server.Implementations/Notifications
parentc3d6c19cc32f1ec16aa5aa1e1691a9d101c1251c (diff)
update metadata editor
Diffstat (limited to 'MediaBrowser.Server.Implementations/Notifications')
-rw-r--r--MediaBrowser.Server.Implementations/Notifications/IConfigurableNotificationService.cs14
-rw-r--r--MediaBrowser.Server.Implementations/Notifications/InternalNotificationService.cs21
-rw-r--r--MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs23
3 files changed, 54 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/Notifications/IConfigurableNotificationService.cs b/MediaBrowser.Server.Implementations/Notifications/IConfigurableNotificationService.cs
new file mode 100644
index 000000000..5c4f400b0
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Notifications/IConfigurableNotificationService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Server.Implementations.Notifications
+{
+ public interface IConfigurableNotificationService
+ {
+ bool IsHidden { get; }
+ bool IsEnabled(string notificationType);
+ }
+}
diff --git a/MediaBrowser.Server.Implementations/Notifications/InternalNotificationService.cs b/MediaBrowser.Server.Implementations/Notifications/InternalNotificationService.cs
index 56cb52f10..4a625f0fb 100644
--- a/MediaBrowser.Server.Implementations/Notifications/InternalNotificationService.cs
+++ b/MediaBrowser.Server.Implementations/Notifications/InternalNotificationService.cs
@@ -3,10 +3,11 @@ using MediaBrowser.Controller.Notifications;
using MediaBrowser.Model.Notifications;
using System.Threading;
using System.Threading.Tasks;
+using System;
namespace MediaBrowser.Server.Implementations.Notifications
{
- public class InternalNotificationService : INotificationService
+ public class InternalNotificationService : INotificationService, IConfigurableNotificationService
{
private readonly INotificationsRepository _repo;
@@ -36,6 +37,24 @@ namespace MediaBrowser.Server.Implementations.Notifications
public bool IsEnabledForUser(User user)
{
+ return user.Policy.IsAdministrator;
+ }
+
+ public bool IsHidden
+ {
+ get { return true; }
+ }
+
+ public bool IsEnabled(string notificationType)
+ {
+ if (notificationType.IndexOf("playback", StringComparison.OrdinalIgnoreCase) != -1)
+ {
+ return false;
+ }
+ if (notificationType.IndexOf("newlibrarycontent", StringComparison.OrdinalIgnoreCase) != -1)
+ {
+ return false;
+ }
return true;
}
}
diff --git a/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs b/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs
index 1ff928cd5..f19ff8a5f 100644
--- a/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs
+++ b/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs
@@ -230,8 +230,19 @@ namespace MediaBrowser.Server.Implementations.Notifications
private bool IsEnabled(INotificationService service, string notificationType)
{
- return string.IsNullOrEmpty(notificationType) ||
- GetConfiguration().IsServiceEnabled(service.Name, notificationType);
+ if (string.IsNullOrEmpty(notificationType))
+ {
+ return true;
+ }
+
+ var configurable = service as IConfigurableNotificationService;
+
+ if (configurable != null)
+ {
+ return configurable.IsEnabled(notificationType);
+ }
+
+ return GetConfiguration().IsServiceEnabled(service.Name, notificationType);
}
public void AddParts(IEnumerable<INotificationService> services, IEnumerable<INotificationTypeFactory> notificationTypeFactories)
@@ -268,7 +279,13 @@ namespace MediaBrowser.Server.Implementations.Notifications
public IEnumerable<NotificationServiceInfo> GetNotificationServices()
{
- return _services.Select(i => new NotificationServiceInfo
+ return _services.Where(i =>
+ {
+ var configurable = i as IConfigurableNotificationService;
+
+ return configurable == null || !configurable.IsHidden;
+
+ }).Select(i => new NotificationServiceInfo
{
Name = i.Name,
Id = i.Name.GetMD5().ToString("N")