diff --git a/.github/workflows/issue-check.yml b/.github/workflows/issue-check.yml index 9dfe5cc45..51b87b8d3 100644 --- a/.github/workflows/issue-check.yml +++ b/.github/workflows/issue-check.yml @@ -8,9 +8,6 @@ jobs: issueCheck: runs-on: ubuntu-latest steps: - - name: Output version - run: | - echo "log: ${{ github.event.issue.body }}" - if: startsWith(github.event.issue.body , '**Describe the bug**') == false name: Close Issue diff --git a/CHANGELOG.md b/CHANGELOG.md index 220e46849..5b7cce69a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +## [4.11.7](https://github.com/Ombi-app/Ombi/compare/v4.11.6...v4.11.7) (2022-02-12) + + +### Bug Fixes + +* **notifications:** :bug: This is a fix for some of the duplicate notification issues [#3825](https://github.com/Ombi-app/Ombi/issues/3825) ([22bb422](https://github.com/Ombi-app/Ombi/commit/22bb4226ead2d62e8c2c2c05be47d7da621402e2)) + + + +## [4.11.6](https://github.com/Ombi-app/Ombi/compare/v4.11.5...v4.11.6) (2022-02-10) + + +### Bug Fixes + +* **plex:** Fixed an issue where in a rare case we couldn't sync the data [#4502](https://github.com/Ombi-app/Ombi/issues/4502) ([191318d](https://github.com/Ombi-app/Ombi/commit/191318ddad5a8148422955bf928f1c49b890e3eb)) + + + ## [4.11.5](https://github.com/Ombi-app/Ombi/compare/v4.11.4...v4.11.5) (2022-02-05) @@ -360,23 +378,3 @@ -## [4.2.13](https://github.com/Ombi-app/Ombi/compare/v4.2.12...v4.2.13) (2021-10-20) - - -### Bug Fixes - -* **translations:** ๐ŸŒ New translations %two_letters_code% from Crowdin [skip ci] ([8fbd267](https://github.com/Ombi-app/Ombi/commit/8fbd267b516ddaa80fd16c091bae532b860fbf45)) - - - -## [4.2.12](https://github.com/Ombi-app/Ombi/compare/v4.2.11...v4.2.12) (2021-10-20) - - -### Bug Fixes - -* **newsletter:** :bug: Fixed a few small bugs in the newsletter ([21dba4c](https://github.com/Ombi-app/Ombi/commit/21dba4c524b98b9f2b883d97e7e13329425a8762)) -* **translations:** ๐ŸŒ New translations en.json from Crowdin [skip ci] ([52eda6a](https://github.com/Ombi-app/Ombi/commit/52eda6ab917a73842bc02b0d8e0c442e564ca8f0)) -* **translations:** ๐ŸŒ New translations en.json from Crowdin [skip ci] ([1095d52](https://github.com/Ombi-app/Ombi/commit/1095d524962648a1e427f0bcd8105fa734dd5b60)) - - - diff --git a/src/Ombi.Api.Plex/Models/Metadata.cs b/src/Ombi.Api.Plex/Models/Metadata.cs index d505e5fb4..65cb21e95 100644 --- a/src/Ombi.Api.Plex/Models/Metadata.cs +++ b/src/Ombi.Api.Plex/Models/Metadata.cs @@ -12,22 +12,15 @@ namespace Ombi.Api.Plex.Models public string contentRating { get; set; } public string summary { get; set; } public int index { get; set; } - //public int viewCount { get; set; } - //public int lastViewedAt { get; set; } public int year { get; set; } public string thumb { get; set; } public string art { get; set; } public string banner { get; set; } public string theme { get; set; } - //public string duration { get; set; } - //public string originallyAvailableAt { get; set; } public int leafCount { get; set; } public int viewedLeafCount { get; set; } public int childCount { get; set; } - //public long addedAt { get; set; } - //public int updatedAt { get; set; } public Genre[] Genre { get; set; } - //public Role[] Role { get; set; } public string primaryExtraKey { get; set; } public int parentRatingKey { get; set; } public int grandparentRatingKey { get; set; } @@ -46,12 +39,10 @@ namespace Ombi.Api.Plex.Models public string chapterSource { get; set; } public Medium[] Media { get; set; } public List Guid { get; set; } = new List(); - // public Director[] Director { get; set; } - // public Writer[] Writer { get; set; } } public class PlexGuids { public string Id { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ombi.Notifications.Tests/NotificationServiceTests.cs b/src/Ombi.Notifications.Tests/NotificationServiceTests.cs new file mode 100644 index 000000000..fedd7707e --- /dev/null +++ b/src/Ombi.Notifications.Tests/NotificationServiceTests.cs @@ -0,0 +1,42 @@ +๏ปฟusing Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Moq.AutoMock; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Ombi.Notifications.Tests +{ + [TestFixture] + public class NotificationServiceTests + { + + private NotitficationServiceTestFacade _subject; + + [SetUp] + public void Setup() + { + var mocker = new AutoMocker(); + mocker.Use(NullLogger.Instance); + _subject = mocker.CreateInstance(); + } + + [Test] + public void PopulateAgentsTests() + { + Assert.That(_subject.Agents, Has.Count.EqualTo(12)); + Assert.That(_subject.Agents.DistinctBy(x => x.NotificationName).ToList(), Has.Count.EqualTo(12)); + } + } + + + public class NotitficationServiceTestFacade : NotificationService + { + public NotitficationServiceTestFacade(IServiceProvider provider, ILogger log) : base(provider, log) + { + } + + public List Agents => base.NotificationAgents; + } +} diff --git a/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj b/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj index b3edbcf6d..e936c9072 100644 --- a/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj +++ b/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj @@ -13,6 +13,7 @@ + diff --git a/src/Ombi.Notifications/BaseNotification.cs b/src/Ombi.Notifications/BaseNotification.cs index 9397767bf..b52f0a0cd 100644 --- a/src/Ombi.Notifications/BaseNotification.cs +++ b/src/Ombi.Notifications/BaseNotification.cs @@ -33,7 +33,7 @@ namespace Ombi.Notifications AlbumRepository = album; UserNotificationPreferences = notificationUserPreferences; _userManager = um; - Settings.ClearCache(); + Settings?.ClearCache(); } protected ISettingsService Settings { get; } @@ -64,7 +64,11 @@ namespace Ombi.Notifications public async Task NotifyAsync(NotificationOptions model, Settings.Settings.Models.Settings settings) { - if (settings == null) await NotifyAsync(model); + if (settings == null) + { + await NotifyAsync(model); + return; + } var notificationSettings = (T)settings; @@ -114,15 +118,13 @@ namespace Ombi.Notifications case NotificationType.IssueComment: await IssueComment(model, notificationSettings); break; - case NotificationType.AdminNote: - break; - case NotificationType.WelcomeEmail: - break; - case NotificationType.Newsletter: - break; case NotificationType.PartiallyAvailable: await PartiallyAvailable(model, notificationSettings); break; + case NotificationType.AdminNote: + case NotificationType.WelcomeEmail: + case NotificationType.Newsletter: + break; default: throw new ArgumentOutOfRangeException(); } diff --git a/src/Ombi.Notifications/NotificationService.cs b/src/Ombi.Notifications/NotificationService.cs index 8a24382aa..f22800cdc 100644 --- a/src/Ombi.Notifications/NotificationService.cs +++ b/src/Ombi.Notifications/NotificationService.cs @@ -23,7 +23,7 @@ namespace Ombi.Notifications PopulateAgents(); } - private List NotificationAgents { get; } + protected List NotificationAgents { get; } private ILogger Log { get; } /// @@ -55,7 +55,7 @@ namespace Ombi.Notifications } - private void PopulateAgents() + protected void PopulateAgents() { var baseSearchType = typeof(BaseNotification<>).Name; diff --git a/version.json b/version.json index 5c318d452..92f0f8328 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "4.11.5" + "version": "4.11.7" } \ No newline at end of file