mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 00:55:13 +01:00
update metadata editor
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user