diff options
5 files changed, 16 insertions, 24 deletions
diff --git a/MediaBrowser.Model/Notifications/NotificationQuery.cs b/MediaBrowser.Model/Notifications/NotificationQuery.cs index 39a7326a6..a252e2512 100644 --- a/MediaBrowser.Model/Notifications/NotificationQuery.cs +++ b/MediaBrowser.Model/Notifications/NotificationQuery.cs @@ -4,7 +4,7 @@ namespace MediaBrowser.Model.Notifications { public class NotificationQuery { - public Guid? UserId { get; set; } + public Guid UserId { get; set; } public bool? IsRead { get; set; } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteNotificationsRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteNotificationsRepository.cs index 7b15467e0..aef8fc03f 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteNotificationsRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteNotificationsRepository.cs @@ -78,30 +78,22 @@ namespace MediaBrowser.Server.Implementations.Persistence /// <returns>NotificationResult.</returns> public NotificationResult GetNotifications(NotificationQuery query) { - var whereClause = string.Empty; - var result = new NotificationResult(); using (var cmd = _connection.CreateCommand()) { - if (query.IsRead.HasValue || query.UserId.HasValue) - { - var clauses = new List<string>(); + var clauses = new List<string>(); - if (query.IsRead.HasValue) - { - clauses.Add("IsRead=@IsRead"); - cmd.Parameters.Add(cmd, "@IsRead", DbType.Boolean).Value = query.IsRead.Value; - } + if (query.IsRead.HasValue) + { + clauses.Add("IsRead=@IsRead"); + cmd.Parameters.Add(cmd, "@IsRead", DbType.Boolean).Value = query.IsRead.Value; + } - if (query.UserId.HasValue) - { - clauses.Add("UserId=@UserId"); - cmd.Parameters.Add(cmd, "@UserId", DbType.Guid).Value = query.UserId.Value; - } + clauses.Add("UserId=@UserId"); + cmd.Parameters.Add(cmd, "@UserId", DbType.Guid).Value = query.UserId; - whereClause = " where " + string.Join(" And ", clauses.ToArray()); - } + var whereClause = " where " + string.Join(" And ", clauses.ToArray()); cmd.CommandText = string.Format("select count(Id) from Notifications{0};select Id,UserId,Date,Name,Description,Url,Level,IsRead,Category,RelatedId from Notifications{0} order by IsRead asc, Date desc", whereClause); @@ -155,7 +147,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } result.UnreadCount = levels.Count; - + if (levels.Count > 0) { result.MaxUnreadNotificationLevel = levels.Max(); diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 5f516844a..e36d29e20 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.139</version> + <version>3.0.140</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.139" /> + <dependency id="MediaBrowser.Common" version="3.0.140" /> <dependency id="NLog" version="2.0.1.2" /> <dependency id="ServiceStack.Text" version="3.9.45" /> <dependency id="SimpleInjector" version="2.2.3" /> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index a466e9058..29e860785 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.139</version> + <version>3.0.140</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 f2684f93b..7f41aed49 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.139</version> + <version>3.0.140</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.139" /> + <dependency id="MediaBrowser.Common" version="3.0.140" /> </dependencies> </metadata> <files> |
