Selaa lähdekoodia

updated nuget

Luke Pulverenti 11 vuotta sitten
vanhempi
sitoutus
3db92516be

+ 7 - 3
MediaBrowser.Model/Notifications/Notification.cs

@@ -1,6 +1,6 @@
-using System;
+using MediaBrowser.Model.Configuration;
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using MediaBrowser.Model.Configuration;
 
 
 namespace MediaBrowser.Model.Notifications
 namespace MediaBrowser.Model.Notifications
 {
 {
@@ -50,13 +50,17 @@ namespace MediaBrowser.Model.Notifications
         public Dictionary<string, string> Variables { get; set; }
         public Dictionary<string, string> Variables { get; set; }
 
 
         public SendToUserType? SendToUserMode { get; set; }
         public SendToUserType? SendToUserMode { get; set; }
-        
+
+        public List<string> ExcludeUserIds { get; set; }
+
         public NotificationRequest()
         public NotificationRequest()
         {
         {
             UserIds = new List<string>();
             UserIds = new List<string>();
             Date = DateTime.UtcNow;
             Date = DateTime.UtcNow;
 
 
             Variables = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
             Variables = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+
+            ExcludeUserIds = new List<string>();
         }
         }
     }
     }
 
 

+ 3 - 1
MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs

@@ -149,7 +149,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
 
 
             var notification = new NotificationRequest
             var notification = new NotificationRequest
             {
             {
-                NotificationType = GetPlaybackNotificationType(item.MediaType)
+                NotificationType = GetPlaybackNotificationType(item.MediaType),
+
+                ExcludeUserIds = e.Users.Select(i => i.Id.ToString("N")).ToList()
             };
             };
 
 
             notification.Variables["ItemName"] = item.Name;
             notification.Variables["ItemName"] = item.Name;

+ 6 - 14
MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs

@@ -38,7 +38,9 @@ namespace MediaBrowser.Server.Implementations.Notifications
                 null :
                 null :
                 _config.Configuration.NotificationOptions.GetOptions(notificationType);
                 _config.Configuration.NotificationOptions.GetOptions(notificationType);
 
 
-            var users = GetUserIds(request, options).Select(i => _userManager.GetUserById(new Guid(i)));
+            var users = GetUserIds(request, options)
+                .Except(request.UserIds)
+                .Select(i => _userManager.GetUserById(new Guid(i)));
 
 
             var title = GetTitle(request, options);
             var title = GetTitle(request, options);
 
 
@@ -81,20 +83,10 @@ namespace MediaBrowser.Server.Implementations.Notifications
                 }
                 }
             }
             }
 
 
-            if (options != null)
+            if (options != null && !string.IsNullOrWhiteSpace(request.NotificationType))
             {
             {
-                switch (options.SendToUserMode)
-                {
-                    case SendToUserType.Admins:
-                        return _userManager.Users.Where(i => i.Configuration.IsAdministrator)
-                                .Select(i => i.Id.ToString("N"));
-                    case SendToUserType.All:
-                        return _userManager.Users.Select(i => i.Id.ToString("N"));
-                    case SendToUserType.Custom:
-                        return options.SendToUsers;
-                    default:
-                        throw new ArgumentException("Unrecognized SendToUserMode: " + options.SendToUserMode);
-                }
+                return _userManager.Users.Where(i => _config.Configuration.NotificationOptions.IsEnabledToSendToUser(request.NotificationType, i.Id.ToString("N"), i.Configuration))
+                   .Select(i => i.Id.ToString("N"));
             }
             }
 
 
             return new List<string>();
             return new List<string>();

+ 2 - 2
Nuget/MediaBrowser.Common.Internal.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Common.Internal</id>
         <id>MediaBrowser.Common.Internal</id>
-        <version>3.0.355</version>
+        <version>3.0.356</version>
         <title>MediaBrowser.Common.Internal</title>
         <title>MediaBrowser.Common.Internal</title>
         <authors>Luke</authors>
         <authors>Luke</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
         <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.355" />
+            <dependency id="MediaBrowser.Common" version="3.0.356" />
             <dependency id="NLog" version="2.1.0" />
             <dependency id="NLog" version="2.1.0" />
             <dependency id="SimpleInjector" version="2.4.1" />
             <dependency id="SimpleInjector" version="2.4.1" />
             <dependency id="sharpcompress" version="0.10.2" />
             <dependency id="sharpcompress" version="0.10.2" />

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Common</id>
         <id>MediaBrowser.Common</id>
-        <version>3.0.355</version>
+        <version>3.0.356</version>
         <title>MediaBrowser.Common</title>
         <title>MediaBrowser.Common</title>
         <authors>Media Browser Team</authors>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <owners>ebr,Luke,scottisafool</owners>

+ 2 - 2
Nuget/MediaBrowser.Server.Core.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Server.Core</id>
         <id>MediaBrowser.Server.Core</id>
-        <version>3.0.355</version>
+        <version>3.0.356</version>
         <title>Media Browser.Server.Core</title>
         <title>Media Browser.Server.Core</title>
         <authors>Media Browser Team</authors>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.355" />
+            <dependency id="MediaBrowser.Common" version="3.0.356" />
         </dependencies>
         </dependencies>
     </metadata>
     </metadata>
     <files>
     <files>