diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-04-27 15:30:12 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-04-27 15:30:12 -0400 |
| commit | 3db92516bea0f473022f257dd61dfeafa6998c75 (patch) | |
| tree | a7a03317f913d85c2e634770ec1963c2a38cad78 | |
| parent | f476944d9168c7c8a8a87e7e439f57ef8aceb4be (diff) | |
updated nuget
6 files changed, 21 insertions, 23 deletions
diff --git a/MediaBrowser.Model/Notifications/Notification.cs b/MediaBrowser.Model/Notifications/Notification.cs index e69875a68..e5040373b 100644 --- a/MediaBrowser.Model/Notifications/Notification.cs +++ b/MediaBrowser.Model/Notifications/Notification.cs @@ -1,6 +1,6 @@ -using System; +using MediaBrowser.Model.Configuration; +using System; using System.Collections.Generic; -using MediaBrowser.Model.Configuration; namespace MediaBrowser.Model.Notifications { @@ -50,13 +50,17 @@ namespace MediaBrowser.Model.Notifications public Dictionary<string, string> Variables { get; set; } public SendToUserType? SendToUserMode { get; set; } - + + public List<string> ExcludeUserIds { get; set; } + public NotificationRequest() { UserIds = new List<string>(); Date = DateTime.UtcNow; Variables = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + + ExcludeUserIds = new List<string>(); } } diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs index 06dcf92ff..217b068bf 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs @@ -149,7 +149,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications 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; diff --git a/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs b/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs index 300d2c351..f3183ec0b 100644 --- a/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs +++ b/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs @@ -38,7 +38,9 @@ namespace MediaBrowser.Server.Implementations.Notifications null : _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); @@ -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>(); diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 91329e9b4..be0925a5f 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common.Internal</id> - <version>3.0.355</version> + <version>3.0.356</version> <title>MediaBrowser.Common.Internal</title> <authors>Luke</authors> <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> <copyright>Copyright © Media Browser 2013</copyright> <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="SimpleInjector" version="2.4.1" /> <dependency id="sharpcompress" version="0.10.2" /> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index adef971ce..c2ac5f7cf 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common</id> - <version>3.0.355</version> + <version>3.0.356</version> <title>MediaBrowser.Common</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index ad00362a5..d64be0f3c 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Server.Core</id> - <version>3.0.355</version> + <version>3.0.356</version> <title>Media Browser.Server.Core</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains core components required to build plugins for Media Browser Server.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.355" /> + <dependency id="MediaBrowser.Common" version="3.0.356" /> </dependencies> </metadata> <files> |
