diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e1047f965..6191c7a55 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -3,6 +3,7 @@ name: CI Build
on:
push:
branches: [ develop, master ]
+ workflow_dispatch:
jobs:
build-ui:
@@ -38,7 +39,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
- dotnet-version: '5.0.x'
+ dotnet-version: '6.0.x'
- name: Nuget Cache
uses: actions/cache@v2
@@ -67,6 +68,7 @@ jobs:
uses: TriPSs/conventional-changelog-action@v3
with:
version-file: 'version.json'
+ release-count: 40
skip-on-empty: 'false'
git-message: 'chore(release): :rocket: {version}'
@@ -102,6 +104,12 @@ jobs:
format: tar.gz
steps:
- uses: actions/checkout@v2
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '6.0.x'
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '5.0.x'
- name: Nuget Cache
uses: actions/cache@v2
diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml
index 499cd272d..2e382eee3 100644
--- a/.github/workflows/cypress.yml
+++ b/.github/workflows/cypress.yml
@@ -7,6 +7,7 @@ on:
branches: [ develop ]
schedule:
- cron: '0 0 * * *'
+ workflow_dispatch:
jobs:
automation-tests:
@@ -18,7 +19,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 5.0.x
+ dotnet-version: 6.0.x
- uses: actions/setup-node@v2
with:
node-version: '14'
@@ -38,7 +39,7 @@ jobs:
- name: Start Backend
run: |
- nohup dotnet run -p ./src/Ombi -- --host http://*:3577 &
+ nohup dotnet run --project ./src/Ombi -- --host http://*:3577 &
- name: Start Frontend
run: |
nohup yarn --cwd ./src/Ombi/ClientApp start &
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index e353dce4d..961871f8a 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -3,6 +3,7 @@ name: PR Build
on:
pull_request:
types: [opened, synchronize, reopened]
+ workflow_dispatch:
jobs:
build-ui:
@@ -31,7 +32,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
- dotnet-version: '5.0.x'
+ dotnet-version: '6.0.x'
- name: Nuget Cache
uses: actions/cache@v2
@@ -89,6 +90,9 @@ jobs:
format: tar.gz
steps:
- uses: actions/checkout@v2
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '6.0.x'
- name: Nuget Cache
uses: actions/cache@v2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0191c7064..44be4a73c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,248 @@
+## [4.10.1](https://github.com/Ombi-app/Ombi/compare/v4.10.0...v4.10.1) (2022-01-22)
+
+
+
+## [4.3.3](https://github.com/Ombi-app/Ombi/compare/v4.3.2...v4.3.3) (2021-11-05)
+
+
+
+# [4.10.0](https://github.com/Ombi-app/Ombi/compare/v4.9.2...v4.10.0) (2022-01-14)
+
+
+### Features
+
+* **notifications:** :sparkles: Send new request email notifications to power users ([#4462](https://github.com/Ombi-app/Ombi/issues/4462)) ([10cc0c0](https://github.com/Ombi-app/Ombi/commit/10cc0c0951f13221179516f8ff5c44dbecc9a0fd))
+
+
+
+## [4.9.2](https://github.com/Ombi-app/Ombi/compare/v4.9.1...v4.9.2) (2022-01-14)
+
+
+### Bug Fixes
+
+* :bug: Add UI for Emby recently added cronjob settings ([#4469](https://github.com/Ombi-app/Ombi/issues/4469)) ([7d47bbe](https://github.com/Ombi-app/Ombi/commit/7d47bbe92204855bf75d70b8fa548f9c3f3612bc))
+* **sonarr:** :bug: Fixed an issue where we could attempt to add a series to sonarr before sonarr has got all the metadata [#4459](https://github.com/Ombi-app/Ombi/issues/4459) ([5c691dc](https://github.com/Ombi-app/Ombi/commit/5c691dc98437a4cd24560ff625414fe05dd22f89))
+* **wizard:** :bug: Fixed the issue where the Application Url wasn't validated in the wizard ([33b8d11](https://github.com/Ombi-app/Ombi/commit/33b8d1111a1c6663d8c0bbd912be4660da7d013f)), closes [#4417](https://github.com/Ombi-app/Ombi/issues/4417)
+
+
+
+## [4.9.1](https://github.com/Ombi-app/Ombi/compare/v4.9.0...v4.9.1) (2022-01-14)
+
+
+### Bug Fixes
+
+* **discover:** 🌐 Localize episodes names in TV details ([#4467](https://github.com/Ombi-app/Ombi/issues/4467)) [skip ci] ([35806ea](https://github.com/Ombi-app/Ombi/commit/35806ea2d2c866d628cf08577026a02ab04e49d9))
+* **email-notifications:** :bug: Fixed the issue where legacy requests were showing broken poster images [#4452](https://github.com/Ombi-app/Ombi/issues/4452) ([0ece2fd](https://github.com/Ombi-app/Ombi/commit/0ece2fd6e0eb01e0b7d4d2a01e1a276c7a9c5a51))
+* **emby/jellyfin:** :bug: A more reliable Emby and Jellyfin sync [skip ci] ([ad677fa](https://github.com/Ombi-app/Ombi/commit/ad677fa02eb75633014e9c9791c21ed2d6a23229))
+
+
+
+# [4.9.0](https://github.com/Ombi-app/Ombi/compare/v4.8.1...v4.9.0) (2022-01-05)
+
+
+### Features
+
+* **customization:** :sparkles: Added possibility for custom favicons ([40af659](https://github.com/Ombi-app/Ombi/commit/40af6593b668d4712327c18f92f5b7b5a0a65e26))
+
+
+
+## [4.8.1](https://github.com/Ombi-app/Ombi/compare/v4.8.0...v4.8.1) (2022-01-04)
+
+
+
+# [4.8.0](https://github.com/Ombi-app/Ombi/compare/v4.7.11...v4.8.0) (2021-12-22)
+
+
+### Bug Fixes
+
+* **auto-delete:** :bug: We now also auto delete music requests, this was previously missing ([9fe1f8e](https://github.com/Ombi-app/Ombi/commit/9fe1f8e988aa31d36e7a685ae19f72d9c8414dc0))
+
+
+### Features
+
+* **details:** :sparkles: Added the notify button back into the details pages for requests ([8b33cdc](https://github.com/Ombi-app/Ombi/commit/8b33cdccef83db8794414b247438214b00860fac))
+
+
+
+## [4.7.11](https://github.com/Ombi-app/Ombi/compare/v4.7.10...v4.7.11) (2021-12-17)
+
+
+### Bug Fixes
+
+* **availability-rules:** :bug: Show the 'Requested' button when a show has all of the episodes marked as requested ([cb7ecf6](https://github.com/Ombi-app/Ombi/commit/cb7ecf684ac3ab204f329a28baecfd4f6cd408f7))
+
+
+
+## [4.7.10](https://github.com/Ombi-app/Ombi/compare/v4.7.9...v4.7.10) (2021-12-16)
+
+
+### Bug Fixes
+
+* **discover:** :bug: Fixed an issue where monitored movies in radarr were not correctly represented on the search results ([75b15bc](https://github.com/Ombi-app/Ombi/commit/75b15bc7cba21f0a14a18c8e64fd52482f5c6325))
+
+
+
+## [4.7.9](https://github.com/Ombi-app/Ombi/compare/v4.7.8...v4.7.9) (2021-12-16)
+
+
+### Bug Fixes
+
+* **sonarr:** :bug: Fixed an issue where we were sometimes incorrectly setting the state of episodes that are already monitored in sonarr ([fd1acb8](https://github.com/Ombi-app/Ombi/commit/fd1acb88cbc5e73f91b7f81e6e28ee06d66b277e))
+
+
+
+## [4.7.8](https://github.com/Ombi-app/Ombi/compare/v4.7.7...v4.7.8) (2021-12-11)
+
+
+### Bug Fixes
+
+* **notifications:** :bug: Fixed the DenyReason sometimes not appearing in the notification message [#4409](https://github.com/Ombi-app/Ombi/issues/4409) ([209e311](https://github.com/Ombi-app/Ombi/commit/209e31175c95f6ee8909d878d45bf8269a9842d9))
+* **oauth:** :lock: Fixed the issue where some users running their browsers in a different language could not open the Plex OAuth window ([d5404ea](https://github.com/Ombi-app/Ombi/commit/d5404eaad7837010d6e4563cd8f7a1009231d362)), closes [#4408](https://github.com/Ombi-app/Ombi/issues/4408)
+* **translations:** 🌐 New translations from Crowdin ([5cfb76c](https://github.com/Ombi-app/Ombi/commit/5cfb76cad7a25eed8b452bf9c01cef8c32804369))
+
+
+
+## [4.7.7](https://github.com/Ombi-app/Ombi/compare/v4.7.6...v4.7.7) (2021-12-08)
+
+
+### Bug Fixes
+
+* **notifications:** 🐛 Do not notify user upon auto approval of a TV show ([#4432](https://github.com/Ombi-app/Ombi/issues/4432)) ([3ad3bdd](https://github.com/Ombi-app/Ombi/commit/3ad3bddd8313d607ee2a39a51a92e61a3673082c)), closes [#4431](https://github.com/Ombi-app/Ombi/issues/4431)
+* **translations:** 🌐 New translations from Crowdin ([8943a97](https://github.com/Ombi-app/Ombi/commit/8943a978bf459eaeb496d50c61c4d1506c727366))
+
+
+
+## [4.7.6](https://github.com/Ombi-app/Ombi/compare/v4.7.5...v4.7.6) (2021-12-02)
+
+
+### Bug Fixes
+
+* **user-management:** :bug: Fixed an issue where you couldn't 'unset' a users custom quality and root folders ([bae96af](https://github.com/Ombi-app/Ombi/commit/bae96af17f50a80ae3ade235a5ef68d5d2dc12ba))
+
+
+
+## [4.7.5](https://github.com/Ombi-app/Ombi/compare/v4.7.4...v4.7.5) (2021-11-28)
+
+
+### Bug Fixes
+
+* **notifications:** fixed an error that could happen when Ombi sends out a issue notification ([7442dcf](https://github.com/Ombi-app/Ombi/commit/7442dcf59da5d2190cc3087b10402e85bcfcf83b))
+* **translations:** 🌐 Fix incorrect text translation reference RequestedByOn ([#4420](https://github.com/Ombi-app/Ombi/issues/4420)) ([202d155](https://github.com/Ombi-app/Ombi/commit/202d155493c29a6ddd4c5507186bf376a28f4c1d))
+* **translations:** 🌐 New translations from Crowdin ([473c172](https://github.com/Ombi-app/Ombi/commit/473c1724922515fe376e0b2058ac391807c923f2))
+
+
+
+## [4.7.4](https://github.com/Ombi-app/Ombi/compare/v4.7.3...v4.7.4) (2021-11-25)
+
+
+### Bug Fixes
+
+* **availability-rules:** :bug: Fixed a small issue where some shows would not appear as Available even know they had no future unaired episodes listed ([914b096](https://github.com/Ombi-app/Ombi/commit/914b096781c9b73292a533a010a5dd05ecfd0aac))
+* **emby:** :bug: Fixed an issue where we were not properly syncing episodes ([75529dd](https://github.com/Ombi-app/Ombi/commit/75529dd972c5102f3c5234a2acf6fe664a1bcfad))
+
+
+
+## [4.7.3](https://github.com/Ombi-app/Ombi/compare/v4.7.2...v4.7.3) (2021-11-23)
+
+
+
+## [4.7.2](https://github.com/Ombi-app/Ombi/compare/v4.7.1...v4.7.2) (2021-11-22)
+
+
+### Bug Fixes
+
+* **request-list:** :bug: Fixed an issue where the bulk delete would not work for movie requests ([4b540fb](https://github.com/Ombi-app/Ombi/commit/4b540fb45bcc389664f0953159802288d005db9f))
+
+
+
+## [4.7.1](https://github.com/Ombi-app/Ombi/compare/v4.7.0...v4.7.1) (2021-11-22)
+
+
+### Bug Fixes
+
+* **emby:** :bug: Fixed an issue where we slightly broke the full sync ([332d934](https://github.com/Ombi-app/Ombi/commit/332d9344d002a5ffd5aeac516c7441dcdec52248))
+
+
+
+# [4.7.0](https://github.com/Ombi-app/Ombi/compare/v4.6.5...v4.7.0) (2021-11-19)
+
+
+### Features
+
+* **emby:** :sparkles: Added a emby recently added sync! ([a0e1406](https://github.com/Ombi-app/Ombi/commit/a0e14068f4bc457f8a4a565de71707a8f16c803c))
+
+
+
+## [4.6.5](https://github.com/Ombi-app/Ombi/compare/v4.6.4...v4.6.5) (2021-11-15)
+
+
+### Bug Fixes
+
+* **issues:** :bug: Added the issue category to the issue 'cards' [#4403](https://github.com/Ombi-app/Ombi/issues/4403) ([a3739f3](https://github.com/Ombi-app/Ombi/commit/a3739f375c49f48e34da12f0a74e4e068f12ab40))
+* **issues:** :bug: Added the issues back to the details page for TV Shows ([0225000](https://github.com/Ombi-app/Ombi/commit/02250000c08a253e57d8a0a855c2d30b8a1e5baa))
+* **issues:** :bug: Fixed an issue where you couldn't navigate to the details page from TV issues ([1a2825b](https://github.com/Ombi-app/Ombi/commit/1a2825bf3839b891b16e1dde4030afe53efe090e))
+* **issues:** :bug: Fixed where we did not show the poster when an issue is raised for media we do not have a request for [#4402](https://github.com/Ombi-app/Ombi/issues/4402) ([15e37b5](https://github.com/Ombi-app/Ombi/commit/15e37b532a83097dbdf1a9fea3eead7d0e211898))
+
+
+
+## [4.6.4](https://github.com/Ombi-app/Ombi/compare/v4.6.3...v4.6.4) (2021-11-12)
+
+
+
+## [4.6.3](https://github.com/Ombi-app/Ombi/compare/v4.6.2...v4.6.3) (2021-11-11)
+
+
+### Bug Fixes
+
+* **discover:** :bug: Display TV + movies on actor page in user language ([#4395](https://github.com/Ombi-app/Ombi/issues/4395)) ([fe635c7](https://github.com/Ombi-app/Ombi/commit/fe635c7106bc487ff879bdc8a73bab16cb389b97))
+* **permissions:** :bug: Improved the security around the role "Manage Own Requests" ([#4397](https://github.com/Ombi-app/Ombi/issues/4397)) ([334a32b](https://github.com/Ombi-app/Ombi/commit/334a32bca42f90198d9b720d2bdb710a583be47f)), closes [#4391](https://github.com/Ombi-app/Ombi/issues/4391)
+* **search:** Fixed some cases where search wouldn't work correctly ([#4398](https://github.com/Ombi-app/Ombi/issues/4398)) ([4410790](https://github.com/Ombi-app/Ombi/commit/4410790bc096826bc11554098f846e3acb59589a))
+
+
+
+## [4.6.2](https://github.com/Ombi-app/Ombi/compare/v4.6.1...v4.6.2) (2021-11-10)
+
+
+### Bug Fixes
+
+* **discover:** TV shows now display on the Actor Pages ([#4388](https://github.com/Ombi-app/Ombi/issues/4388)) ([6b716e7](https://github.com/Ombi-app/Ombi/commit/6b716e722076e3d1e6bf2097c5263645d5ea9edf))
+
+
+
+## [4.6.1](https://github.com/Ombi-app/Ombi/compare/v4.6.0...v4.6.1) (2021-11-10)
+
+
+### Bug Fixes
+
+* :bug: Fixed the MySQL issue after .net 6 upgrade [#4393](https://github.com/Ombi-app/Ombi/issues/4393) ([fea7ff0](https://github.com/Ombi-app/Ombi/commit/fea7ff05139e9ff50c8097fa5389b4ef9ad21a15))
+* **translations:** 🌐 New translations from Crowdin [skip ci] ([c6acb45](https://github.com/Ombi-app/Ombi/commit/c6acb45f8d3f371c0b4024c4272849d0d0cc867f))
+* **translations:** 🌐 New translations from Crowdin [skip ci] ([18c220a](https://github.com/Ombi-app/Ombi/commit/18c220a0cd0d19e45a07d0c319da2b9512778a8a))
+
+
+
+# [4.6.0](https://github.com/Ombi-app/Ombi/compare/v4.4.0...v4.6.0) (2021-11-09)
+
+
+### Features
+
+* :sparkles: Upgrade Ombi to .NET 6 ([#4390](https://github.com/Ombi-app/Ombi/issues/4390)) ([719eb7d](https://github.com/Ombi-app/Ombi/commit/719eb7dbe37b3a72d264e2f670067518eef70694)), closes [#4392](https://github.com/Ombi-app/Ombi/issues/4392)
+
+
+
+# [4.4.0](https://github.com/Ombi-app/Ombi/compare/v4.3.3...v4.4.0) (2021-11-06)
+
+
+### Bug Fixes
+
+* **request-list:** :bug: Fixed an issue where the request options were not appearing for Music requests ([c0406a2](https://github.com/Ombi-app/Ombi/commit/c0406a2ddebafb03d98ed25cdf7d89dc9a600c7d))
+
+
+### Features
+
+* **mass-email:** :sparkles: Added the ability to configure the Mass Email, we can now send BCC and we are less likely to be rate limited when not using bcc [#4377](https://github.com/Ombi-app/Ombi/issues/4377) ([ca655ae](https://github.com/Ombi-app/Ombi/commit/ca655ae57042dec44106a2f2ef5ba2e6f1019ee4))
+
+
+
## [4.3.3](https://github.com/Ombi-app/Ombi/compare/v4.3.2...v4.3.3) (2021-11-05)
@@ -60,3 +305,78 @@
+## [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))
+
+
+
+## [4.2.11](https://github.com/Ombi-app/Ombi/compare/v4.2.10...v4.2.11) (2021-10-18)
+
+
+
+## [4.2.10](https://github.com/Ombi-app/Ombi/compare/v4.2.9...v4.2.10) (2021-10-15)
+
+
+### Bug Fixes
+
+* :bug: Really really fix it this time? ([543d36e](https://github.com/Ombi-app/Ombi/commit/543d36e5615341bc8378cac377b843a3dbc1ef99))
+
+
+
+## [4.2.9](https://github.com/Ombi-app/Ombi/compare/v4.2.8...v4.2.9) (2021-10-15)
+
+
+### Bug Fixes
+
+* :fire: Really fix the base url issue this time ([9f36923](https://github.com/Ombi-app/Ombi/commit/9f36923c51bfabf9cb026f2da14f9947050af0d9))
+
+
+
+## [4.2.8](https://github.com/Ombi-app/Ombi/compare/v4.2.7...v4.2.8) (2021-10-15)
+
+
+### Bug Fixes
+
+* :adhesive_bandage: See if this fixes the proxy issue ([74d1aca](https://github.com/Ombi-app/Ombi/commit/74d1acae499707a7e21401f53eb2bb90c5bb9cfa))
+* :bug: Fixed Ombi not writing the baseUrl correctly ([e9cc8b6](https://github.com/Ombi-app/Ombi/commit/e9cc8b6fe71d3e10c1a901e70227989b3362afe3))
+
+
+
+## [4.2.7](https://github.com/Ombi-app/Ombi/compare/v4.2.6...v4.2.7) (2021-10-14)
+
+
+### Bug Fixes
+
+* :bug: Fixed the issue parsing TheMovieDB dates. They have broken something... ([6e397e0](https://github.com/Ombi-app/Ombi/commit/6e397e02e95f894a92e8bf02428efdcac1275b31))
+
+
+
+## [4.2.6](https://github.com/Ombi-app/Ombi/compare/v4.2.5...v4.2.6) (2021-10-14)
+
+
+### Performance Improvements
+
+* :zap: Use ngxs store for the whole customization section of the app ([97b493d](https://github.com/Ombi-app/Ombi/commit/97b493d869feee59d360b484a6c59388a2aead1f))
+
+
+
+## [4.2.5](https://github.com/Ombi-app/Ombi/compare/v4.2.4...v4.2.5) (2021-10-14)
+
+
+
+## [4.2.4](https://github.com/Ombi-app/Ombi/compare/v4.2.3...v4.2.4) (2021-10-13)
+
+
+### Bug Fixes
+
+* **#4344:** :bug: Fixed an issue where we errored on Plex Episode Scan ([cd5532f](https://github.com/Ombi-app/Ombi/commit/cd5532fa8f7ebbfaf942841398672bafb9a405d4))
+* **#4345:** :bug: Fixed the issue where denied requests we not appearing correctly ([5a2f652](https://github.com/Ombi-app/Ombi/commit/5a2f652a28f5699dd667afef8dde129817e53392))
+
+
+
diff --git a/README.md b/README.md
index 636c58c3e..6b785e94f 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ Don't worry, it's grandma friendly, and more importantly; has wife approval cert
| Service | Stable | Develop
|----------|:---------------------------:|:----------------------------:|
-| Build Status | [![CI Build](https://github.com/Ombi-app/Ombi/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/Ombi-app/Ombi/actions/workflows/build.yml) | [![CI Build](https://github.com/Ombi-app/Ombi/actions/workflows/build.yml/badge.svg)](https://github.com/Ombi-app/Ombi/actions/workflows/build.yml) | [![Build Status](https://dev.azure.com/tidusjar/Ombi/_apis/build/status/Ombi%20CI?branchName=feature%2Fv4)](https://dev.azure.com/tidusjar/Ombi/_build/latest?definitionId=18&branchName=feature%2Fv4)
+| Build Status | [![CI Build](https://github.com/Ombi-app/Ombi/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/Ombi-app/Ombi/actions/workflows/build.yml) | [![CI Build](https://github.com/Ombi-app/Ombi/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/Ombi-app/Ombi/actions/workflows/build.yml) | [![Build Status](https://dev.azure.com/tidusjar/Ombi/_apis/build/status/Ombi%20CI?branchName=feature%2Fv4)](https://dev.azure.com/tidusjar/Ombi/_build/latest?definitionId=18&branchName=feature%2Fv4)
| Download |[![Download](https://img.shields.io/badge/-Download-blue)](https://github.com/Ombi-app/Ombi/releases) | [![Download](https://img.shields.io/badge/-Download-blue)](https://ci.appveyor.com/project/tidusjar/requestplex/branch/develop/artifacts) | [![Download](https://img.shields.io/badge/-Download-blue)](https://github.com/ombi-app/ombi/releases) |
# Feature Requests
@@ -135,6 +135,13 @@ Here are some of the features Ombi has:
Matt Jeanes
+
+
+
+
+ Sephrat
+
+ |
@@ -148,15 +155,15 @@ Here are some of the features Ombi has:
Dhruv Bhavsar
- |
+
+
Joshua M. Boniface
- |
-
+
@@ -164,13 +171,6 @@ Here are some of the features Ombi has:
Bruvv
|
-
-
-
-
- Sephrat
-
- |
@@ -222,10 +222,10 @@ Here are some of the features Ombi has:
|
-
-
+
+
- Stefangross
+ Steffokeffo
|
@@ -730,6 +730,13 @@ Here are some of the features Ombi has:
M4tta
|
+
+
+
+
+ Maartenheebink
+
+ |
@@ -750,15 +757,15 @@ Here are some of the features Ombi has:
Tdorsey
- |
+
+
Mike
- |
-
+
diff --git a/makefile b/makefile
new file mode 100644
index 000000000..62c11e5b5
--- /dev/null
+++ b/makefile
@@ -0,0 +1,17 @@
+backend:
+ cd src/Ombi && dotnet watch run -- --host http://*:3577
+
+frontend:
+ cd src/Ombi/ClientApp && yarn start
+
+install-frontend:
+ cd src/Ombi/ClientApp && yarn
+
+install-frontend-tests:
+ cd tests && yarn
+
+frontend-tests:
+ cd tests && npx cypress run
+
+backend-tests:
+ cd src/Ombi.Core.Tests && dotnet test
\ No newline at end of file
diff --git a/src/Ombi.Api.CloudService/Ombi.Api.CloudService.csproj b/src/Ombi.Api.CloudService/Ombi.Api.CloudService.csproj
index 0701967d1..5939549de 100644
--- a/src/Ombi.Api.CloudService/Ombi.Api.CloudService.csproj
+++ b/src/Ombi.Api.CloudService/Ombi.Api.CloudService.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.CouchPotato/Ombi.Api.CouchPotato.csproj b/src/Ombi.Api.CouchPotato/Ombi.Api.CouchPotato.csproj
index 320c51076..6353f4bf9 100644
--- a/src/Ombi.Api.CouchPotato/Ombi.Api.CouchPotato.csproj
+++ b/src/Ombi.Api.CouchPotato/Ombi.Api.CouchPotato.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Discord/Ombi.Api.Discord.csproj b/src/Ombi.Api.Discord/Ombi.Api.Discord.csproj
index 20c8a9aef..4945a2fb2 100644
--- a/src/Ombi.Api.Discord/Ombi.Api.Discord.csproj
+++ b/src/Ombi.Api.Discord/Ombi.Api.Discord.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.DogNzb/Ombi.Api.DogNzb.csproj b/src/Ombi.Api.DogNzb/Ombi.Api.DogNzb.csproj
index 320c51076..6353f4bf9 100644
--- a/src/Ombi.Api.DogNzb/Ombi.Api.DogNzb.csproj
+++ b/src/Ombi.Api.DogNzb/Ombi.Api.DogNzb.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Emby/EmbyApi.cs b/src/Ombi.Api.Emby/EmbyApi.cs
index c413ecded..d911ca212 100644
--- a/src/Ombi.Api.Emby/EmbyApi.cs
+++ b/src/Ombi.Api.Emby/EmbyApi.cs
@@ -1,12 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
-using Microsoft.EntityFrameworkCore.Internal;
using Newtonsoft.Json;
using Ombi.Api.Emby.Models;
-using Ombi.Api.Emby.Models.Media;
using Ombi.Api.Emby.Models.Media.Tv;
using Ombi.Api.Emby.Models.Movie;
using Ombi.Helpers;
@@ -124,22 +120,36 @@ namespace Ombi.Api.Emby
return response;
}
-
public async Task> GetAllMovies(string apiKey, string parentIdFilder, int startIndex, int count, string userId, string baseUri)
{
return await GetAll("Movie", apiKey, userId, baseUri, true, startIndex, count, parentIdFilder);
}
+ public async Task> RecentlyAddedMovies(string apiKey, string parentIdFilder, int startIndex, int count, string userId, string baseUri)
+ {
+ return await RecentlyAdded("Movie", apiKey, userId, baseUri, true, startIndex, count, parentIdFilder);
+ }
+
public async Task> GetAllEpisodes(string apiKey, string parentIdFilder, int startIndex, int count, string userId, string baseUri)
{
return await GetAll("Episode", apiKey, userId, baseUri, false, startIndex, count, parentIdFilder);
}
+ public async Task> RecentlyAddedEpisodes(string apiKey, string parentIdFilder, int startIndex, int count, string userId, string baseUri)
+ {
+ return await RecentlyAdded("Episode", apiKey, userId, baseUri, false, startIndex, count, parentIdFilder);
+ }
+
public async Task> GetAllShows(string apiKey, string parentIdFilder, int startIndex, int count, string userId, string baseUri)
{
return await GetAll("Series", apiKey, userId, baseUri, false, startIndex, count, parentIdFilder);
}
+ public async Task> RecentlyAddedShows(string apiKey, string parentIdFilder, int startIndex, int count, string userId, string baseUri)
+ {
+ return await RecentlyAdded("Series", apiKey, userId, baseUri, false, startIndex, count, parentIdFilder);
+ }
+
public async Task GetSeriesInformation(string mediaId, string apiKey, string userId, string baseUrl)
{
return await GetInformation(mediaId, apiKey, userId, baseUrl);
@@ -154,6 +164,31 @@ namespace Ombi.Api.Emby
return await GetInformation(mediaId, apiKey, userId, baseUrl);
}
+ private async Task> RecentlyAdded(string type, string apiKey, string userId, string baseUri, bool includeOverview, int startIndex, int count, string parentIdFilder = default)
+ {
+ var request = new Request($"emby/users/{userId}/items", baseUri, HttpMethod.Get);
+
+ request.AddQueryString("Recursive", true.ToString());
+ request.AddQueryString("IncludeItemTypes", type);
+ request.AddQueryString("Fields", includeOverview ? "ProviderIds,Overview" : "ProviderIds");
+ request.AddQueryString("startIndex", startIndex.ToString());
+ request.AddQueryString("limit", count.ToString());
+ request.AddQueryString("sortBy", "DateCreated");
+ request.AddQueryString("SortOrder", "Descending");
+ if (!string.IsNullOrEmpty(parentIdFilder))
+ {
+ request.AddQueryString("ParentId", parentIdFilder);
+ }
+
+ request.AddQueryString("IsVirtualItem", "False");
+
+ AddHeaders(request, apiKey);
+
+
+ var obj = await Api.Request>(request);
+ return obj;
+ }
+
private async Task GetInformation(string mediaId, string apiKey, string userId, string baseUrl)
{
var request = new Request($"emby/users/{userId}/items/{mediaId}", baseUrl, HttpMethod.Get);
diff --git a/src/Ombi.Api.Emby/IBaseEmbyApi.cs b/src/Ombi.Api.Emby/IBaseEmbyApi.cs
index 4de81073d..248c0a88f 100644
--- a/src/Ombi.Api.Emby/IBaseEmbyApi.cs
+++ b/src/Ombi.Api.Emby/IBaseEmbyApi.cs
@@ -29,5 +29,8 @@ namespace Ombi.Api.Emby
Task GetMovieInformation(string mediaId, string apiKey, string userId, string baseUrl);
Task GetEpisodeInformation(string mediaId, string apiKey, string userId, string baseUrl);
Task GetPublicInformation(string baseUrl);
+ Task> RecentlyAddedMovies(string apiKey, string parentIdFilder, int startIndex, int count, string userId, string baseUri);
+ Task> RecentlyAddedEpisodes(string apiKey, string parentIdFilder, int startIndex, int count, string userId, string baseUri);
+ Task> RecentlyAddedShows(string apiKey, string parentIdFilder, int startIndex, int count, string userId, string baseUri);
}
}
\ No newline at end of file
diff --git a/src/Ombi.Api.Emby/Ombi.Api.Emby.csproj b/src/Ombi.Api.Emby/Ombi.Api.Emby.csproj
index 3008c9230..f167146af 100644
--- a/src/Ombi.Api.Emby/Ombi.Api.Emby.csproj
+++ b/src/Ombi.Api.Emby/Ombi.Api.Emby.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.FanartTv/Ombi.Api.FanartTv.csproj b/src/Ombi.Api.FanartTv/Ombi.Api.FanartTv.csproj
index 20c8a9aef..4945a2fb2 100644
--- a/src/Ombi.Api.FanartTv/Ombi.Api.FanartTv.csproj
+++ b/src/Ombi.Api.FanartTv/Ombi.Api.FanartTv.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.Github/Ombi.Api.Github.csproj b/src/Ombi.Api.Github/Ombi.Api.Github.csproj
index 320c51076..6353f4bf9 100644
--- a/src/Ombi.Api.Github/Ombi.Api.Github.csproj
+++ b/src/Ombi.Api.Github/Ombi.Api.Github.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Gotify/Ombi.Api.Gotify.csproj b/src/Ombi.Api.Gotify/Ombi.Api.Gotify.csproj
index 7065a1e65..1285c073c 100644
--- a/src/Ombi.Api.Gotify/Ombi.Api.Gotify.csproj
+++ b/src/Ombi.Api.Gotify/Ombi.Api.Gotify.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.GroupMe/Ombi.Api.GroupMe.csproj b/src/Ombi.Api.GroupMe/Ombi.Api.GroupMe.csproj
index 320c51076..6353f4bf9 100644
--- a/src/Ombi.Api.GroupMe/Ombi.Api.GroupMe.csproj
+++ b/src/Ombi.Api.GroupMe/Ombi.Api.GroupMe.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Jellyfin/Ombi.Api.Jellyfin.csproj b/src/Ombi.Api.Jellyfin/Ombi.Api.Jellyfin.csproj
index 3008c9230..f167146af 100644
--- a/src/Ombi.Api.Jellyfin/Ombi.Api.Jellyfin.csproj
+++ b/src/Ombi.Api.Jellyfin/Ombi.Api.Jellyfin.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.Lidarr/Ombi.Api.Lidarr.csproj b/src/Ombi.Api.Lidarr/Ombi.Api.Lidarr.csproj
index 320c51076..6353f4bf9 100644
--- a/src/Ombi.Api.Lidarr/Ombi.Api.Lidarr.csproj
+++ b/src/Ombi.Api.Lidarr/Ombi.Api.Lidarr.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj b/src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj
index 5742fd3a5..a25024b6c 100644
--- a/src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj
+++ b/src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.MusicBrainz/Ombi.Api.MusicBrainz.csproj b/src/Ombi.Api.MusicBrainz/Ombi.Api.MusicBrainz.csproj
index 65b4175d4..584b980ce 100644
--- a/src/Ombi.Api.MusicBrainz/Ombi.Api.MusicBrainz.csproj
+++ b/src/Ombi.Api.MusicBrainz/Ombi.Api.MusicBrainz.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Notifications/Ombi.Api.Notifications.csproj b/src/Ombi.Api.Notifications/Ombi.Api.Notifications.csproj
index 312aa49f2..f84a8add6 100644
--- a/src/Ombi.Api.Notifications/Ombi.Api.Notifications.csproj
+++ b/src/Ombi.Api.Notifications/Ombi.Api.Notifications.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Plex/Ombi.Api.Plex.csproj b/src/Ombi.Api.Plex/Ombi.Api.Plex.csproj
index 20c8a9aef..4945a2fb2 100644
--- a/src/Ombi.Api.Plex/Ombi.Api.Plex.csproj
+++ b/src/Ombi.Api.Plex/Ombi.Api.Plex.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.Pushbullet/Ombi.Api.Pushbullet.csproj b/src/Ombi.Api.Pushbullet/Ombi.Api.Pushbullet.csproj
index 20c8a9aef..4945a2fb2 100644
--- a/src/Ombi.Api.Pushbullet/Ombi.Api.Pushbullet.csproj
+++ b/src/Ombi.Api.Pushbullet/Ombi.Api.Pushbullet.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.Pushover/Ombi.Api.Pushover.csproj b/src/Ombi.Api.Pushover/Ombi.Api.Pushover.csproj
index 7065a1e65..1285c073c 100644
--- a/src/Ombi.Api.Pushover/Ombi.Api.Pushover.csproj
+++ b/src/Ombi.Api.Pushover/Ombi.Api.Pushover.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj b/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj
index c8ace891e..f14df4f5f 100644
--- a/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj
+++ b/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
@@ -11,7 +11,7 @@
-
+
diff --git a/src/Ombi.Api.RottenTomatoes/Ombi.Api.RottenTomatoes.csproj b/src/Ombi.Api.RottenTomatoes/Ombi.Api.RottenTomatoes.csproj
index 795629ea6..6353f4bf9 100644
--- a/src/Ombi.Api.RottenTomatoes/Ombi.Api.RottenTomatoes.csproj
+++ b/src/Ombi.Api.RottenTomatoes/Ombi.Api.RottenTomatoes.csproj
@@ -1,7 +1,7 @@
-
+
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Service/Ombi.Api.Service.csproj b/src/Ombi.Api.Service/Ombi.Api.Service.csproj
index 0b83f88e0..a344de142 100644
--- a/src/Ombi.Api.Service/Ombi.Api.Service.csproj
+++ b/src/Ombi.Api.Service/Ombi.Api.Service.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
@@ -13,7 +13,7 @@
-
+
diff --git a/src/Ombi.Api.SickRage/Ombi.Api.SickRage.csproj b/src/Ombi.Api.SickRage/Ombi.Api.SickRage.csproj
index 320c51076..6353f4bf9 100644
--- a/src/Ombi.Api.SickRage/Ombi.Api.SickRage.csproj
+++ b/src/Ombi.Api.SickRage/Ombi.Api.SickRage.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Slack/Ombi.Api.Slack.csproj b/src/Ombi.Api.Slack/Ombi.Api.Slack.csproj
index 20c8a9aef..4945a2fb2 100644
--- a/src/Ombi.Api.Slack/Ombi.Api.Slack.csproj
+++ b/src/Ombi.Api.Slack/Ombi.Api.Slack.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.Sonarr/Ombi.Api.Sonarr.csproj b/src/Ombi.Api.Sonarr/Ombi.Api.Sonarr.csproj
index 20c8a9aef..4945a2fb2 100644
--- a/src/Ombi.Api.Sonarr/Ombi.Api.Sonarr.csproj
+++ b/src/Ombi.Api.Sonarr/Ombi.Api.Sonarr.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.Telegram/Ombi.Api.Telegram.csproj b/src/Ombi.Api.Telegram/Ombi.Api.Telegram.csproj
index 320c51076..6353f4bf9 100644
--- a/src/Ombi.Api.Telegram/Ombi.Api.Telegram.csproj
+++ b/src/Ombi.Api.Telegram/Ombi.Api.Telegram.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Trakt/Ombi.Api.Trakt.csproj b/src/Ombi.Api.Trakt/Ombi.Api.Trakt.csproj
index f499f594e..e07f40c60 100644
--- a/src/Ombi.Api.Trakt/Ombi.Api.Trakt.csproj
+++ b/src/Ombi.Api.Trakt/Ombi.Api.Trakt.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.TvMaze/Ombi.Api.TvMaze.csproj b/src/Ombi.Api.TvMaze/Ombi.Api.TvMaze.csproj
index 3008c9230..f167146af 100644
--- a/src/Ombi.Api.TvMaze/Ombi.Api.TvMaze.csproj
+++ b/src/Ombi.Api.TvMaze/Ombi.Api.TvMaze.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api.Twilio/Ombi.Api.Twilio.csproj b/src/Ombi.Api.Twilio/Ombi.Api.Twilio.csproj
index a5bb9ea19..8e12c7c67 100644
--- a/src/Ombi.Api.Twilio/Ombi.Api.Twilio.csproj
+++ b/src/Ombi.Api.Twilio/Ombi.Api.Twilio.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Api.Webhook/Ombi.Api.Webhook.csproj b/src/Ombi.Api.Webhook/Ombi.Api.Webhook.csproj
index 109e3e3f1..7748aad45 100644
--- a/src/Ombi.Api.Webhook/Ombi.Api.Webhook.csproj
+++ b/src/Ombi.Api.Webhook/Ombi.Api.Webhook.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Api/ApiHelper.cs b/src/Ombi.Api/ApiHelper.cs
index fa9d3e7ab..f88525869 100644
--- a/src/Ombi.Api/ApiHelper.cs
+++ b/src/Ombi.Api/ApiHelper.cs
@@ -66,6 +66,8 @@ namespace Ombi.Api
startingTag = builder.Query.Contains("?") ? "&" : "?";
}
+ value = Uri.EscapeDataString(value);
+
builder.Query = hasQuery
? $"{builder.Query}{startingTag}{parameter}={value}"
: $"{startingTag}{parameter}={value}";
diff --git a/src/Ombi.Api/Ombi.Api.csproj b/src/Ombi.Api/Ombi.Api.csproj
index 02969e665..83c3ee62e 100644
--- a/src/Ombi.Api/Ombi.Api.csproj
+++ b/src/Ombi.Api/Ombi.Api.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj
index fcbdab967..4e01e32cd 100644
--- a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj
+++ b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
true
true
Debug;Release;NonUiBuild
@@ -9,7 +9,7 @@
-
+
diff --git a/src/Ombi.Core.Tests/Rule/Search/ExistingRequestRuleTests.cs b/src/Ombi.Core.Tests/Rule/Search/ExistingRequestRuleTests.cs
index ea9208cf7..11860ce28 100644
--- a/src/Ombi.Core.Tests/Rule/Search/ExistingRequestRuleTests.cs
+++ b/src/Ombi.Core.Tests/Rule/Search/ExistingRequestRuleTests.cs
@@ -130,5 +130,76 @@ namespace Ombi.Core.Tests.Rule.Search
Assert.False(search.Approved);
Assert.False(search.Requested);
}
+
+ [Test]
+ public async Task ShouldBeFullyAvailable_NoFutureAiredEpisodes_NoRequest()
+ {
+ var search = new SearchTvShowViewModel()
+ {
+ Id = 999,
+ SeasonRequests = new List
+ {
+ new SeasonRequests
+ {
+ Episodes = new List
+ {
+ new EpisodeRequests
+ {
+ Available = true,
+ AirDate = new System.DateTime(2020,01,01)
+ },
+ new EpisodeRequests
+ {
+ Available = true,
+ AirDate = new System.DateTime(2020,01,02)
+ },
+ }
+ }
+ }
+ };
+ var result = await Rule.Execute(search);
+
+ Assert.True(result.Success);
+ Assert.That(search.FullyAvailable, Is.True);
+ Assert.That(search.PartlyAvailable, Is.False);
+ }
+
+ [Test]
+ public async Task ShouldBeFullyAvailable_AndPartly_FutureAiredEpisodes_NoRequest()
+ {
+ var search = new SearchTvShowViewModel()
+ {
+ Id = 999,
+ SeasonRequests = new List
+ {
+ new SeasonRequests
+ {
+ Episodes = new List
+ {
+ new EpisodeRequests
+ {
+ Available = true,
+ AirDate = new System.DateTime(2020,01,01)
+ },
+ new EpisodeRequests
+ {
+ Available = true,
+ AirDate = new System.DateTime(2020,01,02)
+ },
+ new EpisodeRequests
+ {
+ Available = true,
+ AirDate = new System.DateTime(2029,01,02)
+ },
+ }
+ }
+ }
+ };
+ var result = await Rule.Execute(search);
+
+ Assert.True(result.Success);
+ Assert.That(search.FullyAvailable, Is.True);
+ Assert.That(search.PartlyAvailable, Is.True);
+ }
}
}
\ No newline at end of file
diff --git a/src/Ombi.Core.Tests/Senders/MassEmailSenderTests.cs b/src/Ombi.Core.Tests/Senders/MassEmailSenderTests.cs
new file mode 100644
index 000000000..5c5cedabe
--- /dev/null
+++ b/src/Ombi.Core.Tests/Senders/MassEmailSenderTests.cs
@@ -0,0 +1,228 @@
+using Microsoft.Extensions.Logging;
+using MockQueryable.Moq;
+using Moq;
+using Moq.AutoMock;
+using NUnit.Framework;
+using Ombi.Core.Authentication;
+using Ombi.Core.Models;
+using Ombi.Core.Senders;
+using Ombi.Notifications;
+using Ombi.Notifications.Models;
+using Ombi.Settings.Settings.Models.Notifications;
+using Ombi.Store.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Ombi.Core.Tests.Senders
+{
+ [TestFixture]
+ public class MassEmailSenderTests
+ {
+
+ private MassEmailSender _subject;
+ private AutoMocker _mocker;
+
+ [SetUp]
+ public void Setup()
+ {
+ _mocker = new AutoMocker();
+ _subject = _mocker.CreateInstance();
+ }
+
+ [Test]
+ public async Task SendMassEmail_SingleUser()
+ {
+ var model = new MassEmailModel
+ {
+ Body = "Test",
+ Subject = "Subject",
+ Users = new List
+ {
+ new OmbiUser
+ {
+ Id = "a"
+ }
+ }
+ };
+
+ _mocker.Setup>(x => x.Users).Returns(new List
+ {
+ new OmbiUser
+ {
+ Id = "a",
+ Email = "Test@test.com"
+ }
+ }.AsQueryable().BuildMock().Object);
+
+ var result = await _subject.SendMassEmail(model);
+
+ _mocker.Verify(x => x.SendAdHoc(It.Is(m => m.Subject == model.Subject
+ && m.Message == model.Body
+ && m.To == "Test@test.com"), It.IsAny()), Times.Once);
+ }
+
+ [Test]
+ public async Task SendMassEmail_MultipleUsers()
+ {
+ var model = new MassEmailModel
+ {
+ Body = "Test",
+ Subject = "Subject",
+ Users = new List
+ {
+ new OmbiUser
+ {
+ Id = "a"
+ },
+ new OmbiUser
+ {
+ Id = "b"
+ }
+ }
+ };
+
+ _mocker.Setup>(x => x.Users).Returns(new List
+ {
+ new OmbiUser
+ {
+ Id = "a",
+ Email = "Test@test.com"
+ },
+ new OmbiUser
+ {
+ Id = "b",
+ Email = "b@test.com"
+ }
+ }.AsQueryable().BuildMock().Object);
+
+ var result = await _subject.SendMassEmail(model);
+
+ _mocker.Verify(x => x.SendAdHoc(It.Is(m => m.Subject == model.Subject
+ && m.Message == model.Body
+ && m.To == "Test@test.com"), It.IsAny()), Times.Once);
+ _mocker.Verify(x => x.SendAdHoc(It.Is(m => m.Subject == model.Subject
+ && m.Message == model.Body
+ && m.To == "b@test.com"), It.IsAny()), Times.Once);
+ }
+
+ [Test]
+ public async Task SendMassEmail_UserNoEmail()
+ {
+ var model = new MassEmailModel
+ {
+ Body = "Test",
+ Subject = "Subject",
+ Users = new List
+ {
+ new OmbiUser
+ {
+ Id = "a"
+ }
+ }
+ };
+
+ _mocker.Setup>(x => x.Users).Returns(new List
+ {
+ new OmbiUser
+ {
+ Id = "a",
+ }
+ }.AsQueryable().BuildMock().Object);
+
+ var result = await _subject.SendMassEmail(model);
+ _mocker.Verify>(
+ x => x.Log(
+ LogLevel.Information,
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny>()),
+ Times.Once);
+
+ _mocker.Verify(x => x.SendAdHoc(It.IsAny(), It.IsAny()), Times.Never);
+ }
+
+ [Test]
+ public async Task SendMassEmail_Bcc()
+ {
+ var model = new MassEmailModel
+ {
+ Body = "Test",
+ Subject = "Subject",
+ Bcc = true,
+ Users = new List
+ {
+ new OmbiUser
+ {
+ Id = "a"
+ },
+ new OmbiUser
+ {
+ Id = "b"
+ }
+ }
+ };
+
+ _mocker.Setup>(x => x.Users).Returns(new List
+ {
+ new OmbiUser
+ {
+ Id = "a",
+ Email = "Test@test.com"
+ },
+ new OmbiUser
+ {
+ Id = "b",
+ Email = "b@test.com"
+ }
+ }.AsQueryable().BuildMock().Object);
+
+ var result = await _subject.SendMassEmail(model);
+
+ _mocker.Verify(x => x.SendAdHoc(It.Is(m => m.Subject == model.Subject
+ && m.Message == model.Body
+ && m.Other["bcc"] == "Test@test.com,b@test.com"), It.IsAny()), Times.Once);
+ }
+
+ [Test]
+ public async Task SendMassEmail_Bcc_NoEmails()
+ {
+ var model = new MassEmailModel
+ {
+ Body = "Test",
+ Subject = "Subject",
+ Bcc = true,
+ Users = new List
+ {
+ new OmbiUser
+ {
+ Id = "a"
+ },
+ new OmbiUser
+ {
+ Id = "b"
+ }
+ }
+ };
+
+ _mocker.Setup>(x => x.Users).Returns(new List
+ {
+ new OmbiUser
+ {
+ Id = "a",
+ },
+ new OmbiUser
+ {
+ Id = "b",
+ }
+ }.AsQueryable().BuildMock().Object);
+
+ var result = await _subject.SendMassEmail(model);
+
+ _mocker.Verify(x => x.SendAdHoc(It.IsAny(), It.IsAny()), Times.Never);
+ }
+
+ }
+}
diff --git a/src/Ombi.Core/Engine/BaseMediaEngine.cs b/src/Ombi.Core/Engine/BaseMediaEngine.cs
index 91f8a58b0..277144ab1 100644
--- a/src/Ombi.Core/Engine/BaseMediaEngine.cs
+++ b/src/Ombi.Core/Engine/BaseMediaEngine.cs
@@ -78,6 +78,32 @@ namespace Ombi.Core.Engine
return _dbTv;
}
+ protected async Task CheckCanManageRequest(BaseRequest request) {
+ var errorResult = new RequestEngineResult {
+ Result = false,
+ ErrorCode = ErrorCode.NoPermissions
+ };
+ var successResult = new RequestEngineResult { Result = true };
+
+ // Admins can always manage requests
+ var isAdmin = await IsInRole(OmbiRoles.PowerUser) || await IsInRole(OmbiRoles.Admin);
+ if (isAdmin) {
+ return successResult;
+ }
+
+ // Users with 'ManageOwnRequests' can only manage their own requests
+ var canManageOwnRequests = await IsInRole(OmbiRoles.ManageOwnRequests);
+ if (!canManageOwnRequests) {
+ return errorResult;
+ }
+ var isRequestedBySameUser = ( await GetUser() ).Id == request.RequestedUser?.Id;
+ if (isRequestedBySameUser) {
+ return successResult;
+ }
+
+ return errorResult;
+ }
+
public RequestCountModel RequestCount()
{
var movieQuery = MovieRepository.GetAll();
diff --git a/src/Ombi.Core/Engine/IMusicRequestEngine.cs b/src/Ombi.Core/Engine/IMusicRequestEngine.cs
index 4dbb3b16a..fcdb06496 100644
--- a/src/Ombi.Core/Engine/IMusicRequestEngine.cs
+++ b/src/Ombi.Core/Engine/IMusicRequestEngine.cs
@@ -18,7 +18,7 @@ namespace Ombi.Core.Engine
Task GetTotal();
Task MarkAvailable(int modelId);
Task MarkUnavailable(int modelId);
- Task RemoveAlbumRequest(int requestId);
+ Task RemoveAlbumRequest(int requestId);
Task RequestAlbum(MusicAlbumRequestViewModel model);
Task> SearchAlbumRequest(string search);
Task UserHasRequest(string userId);
diff --git a/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs b/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs
index dfcd1b1da..7cc64bee2 100644
--- a/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs
+++ b/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs
@@ -14,7 +14,7 @@ namespace Ombi.Core.Engine.Interfaces
Task> SearchMovieRequest(string search);
Task RequestCollection(int collectionId, CancellationToken cancellationToken);
- Task RemoveMovieRequest(int requestId);
+ Task RemoveMovieRequest(int requestId);
Task RemoveAllMovieRequests();
Task GetRequest(int requestId);
Task UpdateMovieRequest(MovieRequests request);
diff --git a/src/Ombi.Core/Engine/Interfaces/ITvRequestEngine.cs b/src/Ombi.Core/Engine/Interfaces/ITvRequestEngine.cs
index c93403b3e..6fdf52c56 100644
--- a/src/Ombi.Core/Engine/Interfaces/ITvRequestEngine.cs
+++ b/src/Ombi.Core/Engine/Interfaces/ITvRequestEngine.cs
@@ -20,7 +20,7 @@ namespace Ombi.Core.Engine.Interfaces
Task UpdateTvRequest(TvRequests request);
Task> GetAllChldren(int tvId);
Task UpdateChildRequest(ChildRequests request);
- Task RemoveTvChild(int requestId);
+ Task RemoveTvChild(int requestId);
Task ApproveChildRequest(int id);
Task> GetRequestsLite();
Task UpdateQualityProfile(int requestId, int profileId);
diff --git a/src/Ombi.Core/Engine/Interfaces/ITvSearchEngineV2.cs b/src/Ombi.Core/Engine/Interfaces/ITvSearchEngineV2.cs
index 25a3c2621..2e01e739e 100644
--- a/src/Ombi.Core/Engine/Interfaces/ITvSearchEngineV2.cs
+++ b/src/Ombi.Core/Engine/Interfaces/ITvSearchEngineV2.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
+using Ombi.Api.TheMovieDb.Models;
using Ombi.Core.Models.Search;
using Ombi.Core.Models.Search.V2;
@@ -10,6 +11,7 @@ namespace Ombi.Core
{
Task GetShowInformation(string tvdbid, CancellationToken token);
Task GetShowByRequest(int requestId, CancellationToken token);
+ Task GetTvByActor(int actorId, string langCode);
Task> GetStreamInformation(int movieDbId, CancellationToken cancellationToken);
Task> Popular(int currentlyLoaded, int amountToLoad, string langCustomCode = null);
Task> Anticipated(int currentlyLoaded, int amountToLoad);
diff --git a/src/Ombi.Core/Engine/MovieRequestEngine.cs b/src/Ombi.Core/Engine/MovieRequestEngine.cs
index 63aa0d376..f69e890be 100644
--- a/src/Ombi.Core/Engine/MovieRequestEngine.cs
+++ b/src/Ombi.Core/Engine/MovieRequestEngine.cs
@@ -527,11 +527,12 @@ namespace Ombi.Core.Engine
request.Denied = true;
request.DeniedReason = denyReason;
- // We are denying a request
- await NotificationHelper.Notify(request, NotificationType.RequestDeclined);
await MovieRepository.Update(request);
await _mediaCacheService.Purge();
+ // We are denying a request
+ await NotificationHelper.Notify(request, NotificationType.RequestDeclined);
+
return new RequestEngineResult
{
Result = true,
@@ -654,11 +655,20 @@ namespace Ombi.Core.Engine
///
/// The request identifier.
///
- public async Task RemoveMovieRequest(int requestId)
+ public async Task RemoveMovieRequest(int requestId)
{
var request = await MovieRepository.GetAll().FirstOrDefaultAsync(x => x.Id == requestId);
+
+ var result = await CheckCanManageRequest(request);
+ if (result.IsError)
+ return result;
+
await MovieRepository.Delete(request);
await _mediaCacheService.Purge();
+ return new RequestEngineResult
+ {
+ Result = true,
+ };
}
public async Task RemoveAllMovieRequests()
diff --git a/src/Ombi.Core/Engine/MusicRequestEngine.cs b/src/Ombi.Core/Engine/MusicRequestEngine.cs
index d0a9cc5d7..b9aa183d2 100644
--- a/src/Ombi.Core/Engine/MusicRequestEngine.cs
+++ b/src/Ombi.Core/Engine/MusicRequestEngine.cs
@@ -404,10 +404,20 @@ namespace Ombi.Core.Engine
///
/// The request identifier.
///
- public async Task RemoveAlbumRequest(int requestId)
+ public async Task RemoveAlbumRequest(int requestId)
{
var request = await MusicRepository.GetAll().FirstOrDefaultAsync(x => x.Id == requestId);
+
+ var result = await CheckCanManageRequest(request);
+ if (result.IsError)
+ return result;
+
await MusicRepository.Delete(request);
+
+ return new RequestEngineResult
+ {
+ Result = true,
+ };
}
public async Task UserHasRequest(string userId)
diff --git a/src/Ombi.Core/Engine/RequestEngineResult.cs b/src/Ombi.Core/Engine/RequestEngineResult.cs
index 08c61b7ae..a2f4f93f4 100644
--- a/src/Ombi.Core/Engine/RequestEngineResult.cs
+++ b/src/Ombi.Core/Engine/RequestEngineResult.cs
@@ -7,7 +7,7 @@ namespace Ombi.Core.Engine
{
public bool Result { get; set; }
public string Message { get; set; }
- public bool IsError => !string.IsNullOrEmpty(ErrorMessage);
+ public bool IsError => ( !string.IsNullOrEmpty(ErrorMessage) || ErrorCode != null );
public string ErrorMessage { get; set; }
public ErrorCode? ErrorCode { get; set; }
public int RequestId { get; set; }
diff --git a/src/Ombi.Core/Engine/TvRequestEngine.cs b/src/Ombi.Core/Engine/TvRequestEngine.cs
index fd306f951..edfa7b392 100644
--- a/src/Ombi.Core/Engine/TvRequestEngine.cs
+++ b/src/Ombi.Core/Engine/TvRequestEngine.cs
@@ -710,7 +710,11 @@ namespace Ombi.Core.Engine
if (request.Approved)
{
- await NotificationHelper.Notify(request, NotificationType.RequestApproved);
+ var canNotify = await RunSpecificRule(request, SpecificRules.CanSendNotification, string.Empty);
+ if (canNotify.Success)
+ {
+ await NotificationHelper.Notify(request, NotificationType.RequestApproved);
+ }
// Autosend
await TvSender.Send(request);
}
@@ -749,10 +753,14 @@ namespace Ombi.Core.Engine
return request;
}
- public async Task RemoveTvChild(int requestId)
+ public async Task RemoveTvChild(int requestId)
{
var request = await TvRepository.GetChild().FirstOrDefaultAsync(x => x.Id == requestId);
+ var result = await CheckCanManageRequest(request);
+ if (result.IsError)
+ return result;
+
TvRepository.Db.ChildRequests.Remove(request);
var all = TvRepository.Db.TvRequests.Include(x => x.ChildRequests);
var parent = all.FirstOrDefault(x => x.Id == request.ParentRequestId);
@@ -766,6 +774,11 @@ namespace Ombi.Core.Engine
await TvRepository.Db.SaveChangesAsync();
await _mediaCacheService.Purge();
+
+ return new RequestEngineResult
+ {
+ Result = true,
+ };
}
public async Task RemoveTvRequest(int requestId)
@@ -948,7 +961,11 @@ namespace Ombi.Core.Engine
if (model.Approved)
{
// Autosend
- await NotificationHelper.Notify(model, NotificationType.RequestApproved);
+ var canNotify = await RunSpecificRule(model, SpecificRules.CanSendNotification, string.Empty);
+ if (canNotify.Success)
+ {
+ await NotificationHelper.Notify(model, NotificationType.RequestApproved);
+ }
var result = await TvSender.Send(model);
if (result.Success)
{
diff --git a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs
index e865c6465..7c69e4d5d 100644
--- a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs
+++ b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs
@@ -323,6 +323,7 @@ namespace Ombi.Core.Engine.V2
public async Task GetMoviesByActor(int actorId, string langCode)
{
+ langCode = await DefaultLanguageCode(langCode);
var result = await Cache.GetOrAddAsync(nameof(GetMoviesByActor) + actorId + langCode,
() => MovieApi.GetActorMovieCredits(actorId, langCode), DateTimeOffset.Now.AddHours(12));
// Later we run this through the rules engine
diff --git a/src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs
index 26cba7c14..07f8ce981 100644
--- a/src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs
+++ b/src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs
@@ -89,7 +89,7 @@ namespace Ombi.Core.Engine.V2
foreach (var tvSeason in show.seasons.Where(x => x.season_number != 0)) // skip the first season
{
- var seasonEpisodes = (await _movieApi.GetSeasonEpisodes(show.id, tvSeason.season_number, token));
+ var seasonEpisodes = (await _movieApi.GetSeasonEpisodes(show.id, tvSeason.season_number, token, langCode));
MapSeasons(mapped.SeasonRequests, tvSeason, seasonEpisodes);
}
@@ -147,6 +147,13 @@ namespace Ombi.Core.Engine.V2
return await processed;
}
+ public async Task GetTvByActor(int actorId, string langCode)
+ {
+ langCode = await DefaultLanguageCode(langCode);
+ var result = await Cache.GetOrAddAsync(nameof(GetTvByActor) + actorId + langCode,
+ () => _movieApi.GetActorTvCredits(actorId, langCode), DateTimeOffset.Now.AddHours(12));
+ return result;
+ }
public async Task> GetStreamInformation(int movieDbId, CancellationToken cancellationToken)
{
diff --git a/src/Ombi.Core/Models/MassEmailModel.cs b/src/Ombi.Core/Models/MassEmailModel.cs
index ad09f0cb9..e175c0886 100644
--- a/src/Ombi.Core/Models/MassEmailModel.cs
+++ b/src/Ombi.Core/Models/MassEmailModel.cs
@@ -35,6 +35,8 @@ namespace Ombi.Core.Models
public string Subject { get; set; }
public string Body { get; set; }
+ public bool Bcc { get; set; }
+
public List Users { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Ombi.Core/Ombi.Core.csproj b/src/Ombi.Core/Ombi.Core.csproj
index 857de0bab..359792e0d 100644
--- a/src/Ombi.Core/Ombi.Core.csproj
+++ b/src/Ombi.Core/Ombi.Core.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/src/Ombi.Core/Rule/Rules/Search/ExistingRule.cs b/src/Ombi.Core/Rule/Rules/Search/ExistingRule.cs
index a7cd43336..58c2508a6 100644
--- a/src/Ombi.Core/Rule/Rules/Search/ExistingRule.cs
+++ b/src/Ombi.Core/Rule/Rules/Search/ExistingRule.cs
@@ -85,11 +85,18 @@ namespace Ombi.Core.Rule.Rules.Search
{
request.FullyAvailable = true;
}
- if (request.SeasonRequests.Any() && request.SeasonRequests.All(x => x.Episodes.Any(e => e.Available && e.AirDate > DateTime.MinValue)))
+ if (request.SeasonRequests.Any() && request.SeasonRequests.All(x => x.Episodes.Any(e => e.Available && e.AirDate > DateTime.MinValue && e.AirDate <= DateTime.UtcNow)))
{
request.PartlyAvailable = true;
}
+ var hasUnairedRequests = request.SeasonRequests.Any() && request.SeasonRequests.All(x => x.Episodes.Any(e => e.AirDate >= DateTime.UtcNow));
+
+ if (request.FullyAvailable)
+ {
+ request.PartlyAvailable = hasUnairedRequests;
+ }
+
return Success();
}
if (obj.Type == RequestType.Album)
diff --git a/src/Ombi.Core/Senders/MassEmailSender.cs b/src/Ombi.Core/Senders/MassEmailSender.cs
index 604224b34..106a63f49 100644
--- a/src/Ombi.Core/Senders/MassEmailSender.cs
+++ b/src/Ombi.Core/Senders/MassEmailSender.cs
@@ -25,7 +25,9 @@
// ************************************************************************/
#endregion
+using System;
using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
@@ -64,6 +66,63 @@ namespace Ombi.Core.Senders
var customization = await _customizationService.GetSettingsAsync();
var email = await _emailService.GetSettingsAsync();
var messagesSent = new List();
+ if (model.Bcc)
+ {
+ await SendBccMails(model, customization, email, messagesSent);
+ }
+ else
+ {
+ await SendIndividualEmails(model, customization, email, messagesSent);
+ }
+
+ await Task.WhenAll(messagesSent);
+
+ return true;
+ }
+
+ private async Task SendBccMails(MassEmailModel model, CustomizationSettings customization, EmailNotificationSettings email, List messagesSent)
+ {
+ var resolver = new NotificationMessageResolver();
+ var curlys = new NotificationMessageCurlys();
+
+ var validUsers = new List();
+ foreach (var user in model.Users)
+ {
+ var fullUser = await _userManager.Users.FirstOrDefaultAsync(x => x.Id == user.Id);
+ if (!fullUser.Email.HasValue())
+ {
+ _log.LogInformation("User {0} has no email, cannot send mass email to this user", fullUser.UserName);
+ continue;
+ }
+
+ validUsers.Add(fullUser);
+ }
+
+ if (!validUsers.Any())
+ {
+ return;
+ }
+
+ var firstUser = validUsers.FirstOrDefault();
+
+ var bccAddress = string.Join(',', validUsers.Select(x => x.Email));
+ curlys.Setup(firstUser, customization);
+ var template = new NotificationTemplates() { Message = model.Body, Subject = model.Subject };
+ var content = resolver.ParseMessage(template, curlys);
+ var msg = new NotificationMessage
+ {
+ Message = content.Message,
+ Subject = content.Subject,
+ Other = new Dictionary { { "bcc", bccAddress } }
+ };
+
+ messagesSent.Add(_email.SendAdHoc(msg, email));
+ }
+
+ private async Task SendIndividualEmails(MassEmailModel model, CustomizationSettings customization, EmailNotificationSettings email, List messagesSent)
+ {
+ var resolver = new NotificationMessageResolver();
+ var curlys = new NotificationMessageCurlys();
foreach (var user in model.Users)
{
var fullUser = await _userManager.Users.FirstOrDefaultAsync(x => x.Id == user.Id);
@@ -72,8 +131,6 @@ namespace Ombi.Core.Senders
_log.LogInformation("User {0} has no email, cannot send mass email to this user", fullUser.UserName);
continue;
}
- var resolver = new NotificationMessageResolver();
- var curlys = new NotificationMessageCurlys();
curlys.Setup(fullUser, customization);
var template = new NotificationTemplates() { Message = model.Body, Subject = model.Subject };
var content = resolver.ParseMessage(template, curlys);
@@ -83,13 +140,19 @@ namespace Ombi.Core.Senders
To = fullUser.Email,
Subject = content.Subject
};
- messagesSent.Add(_email.SendAdHoc(msg, email));
+ messagesSent.Add(DelayEmail(msg, email));
_log.LogInformation("Sent mass email to user {0} @ {1}", fullUser.UserName, fullUser.Email);
}
+ }
- await Task.WhenAll(messagesSent);
-
- return true;
+ ///
+ /// This will add a 2 second delay, this is to help with concurrent connection limits
+ ///
+ ///
+ private async Task DelayEmail(NotificationMessage msg, EmailNotificationSettings email)
+ {
+ await Task.Delay(2000);
+ await _email.SendAdHoc(msg, email);
}
}
}
\ No newline at end of file
diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs
index 2f42a12c0..9f60d2ba0 100644
--- a/src/Ombi.Core/Senders/TvSender.cs
+++ b/src/Ombi.Core/Senders/TvSender.cs
@@ -309,6 +309,22 @@ namespace Ombi.Core.Senders
private async Task SendToSonarr(ChildRequests model, SonarrSeries result, SonarrSettings s)
{
+ // Check to ensure we have the all the seasons, ensure the Sonarr metadata has grabbed all the data
+ Season existingSeason = null;
+ foreach (var season in model.SeasonRequests)
+ {
+ var attempt = 0;
+ existingSeason = result.seasons.FirstOrDefault(x => x.seasonNumber == season.SeasonNumber);
+ while (existingSeason == null && attempt < 5)
+ {
+ attempt++;
+ Logger.LogInformation("There was no season numer {0} in Sonarr for title {1}. Will try again as the metadata did not get created", season.SeasonNumber, model.ParentRequest.Title);
+ result = await SonarrApi.GetSeriesById(result.id, s.ApiKey, s.FullUri);
+ existingSeason = result.seasons.FirstOrDefault(x => x.seasonNumber == season.SeasonNumber);
+ await Task.Delay(500);
+ }
+ }
+
var episodesToUpdate = new List();
// Ok, now let's sort out the episodes.
@@ -327,24 +343,20 @@ namespace Ombi.Core.Senders
await Task.Delay(500);
}
+ var seriesChanges = false;
- foreach (var req in model.SeasonRequests)
+ foreach (var season in model.SeasonRequests)
{
- foreach (var ep in req.Episodes)
+ foreach (var ep in season.Episodes)
{
var sonarrEp = sonarrEpList.FirstOrDefault(x =>
- x.episodeNumber == ep.EpisodeNumber && x.seasonNumber == req.SeasonNumber);
+ x.episodeNumber == ep.EpisodeNumber && x.seasonNumber == season.SeasonNumber);
if (sonarrEp != null && !sonarrEp.monitored)
{
sonarrEp.monitored = true;
episodesToUpdate.Add(sonarrEp);
}
}
- }
- var seriesChanges = false;
-
- foreach (var season in model.SeasonRequests)
- {
var sonarrEpisodeList = sonarrEpList.Where(x => x.seasonNumber == season.SeasonNumber).ToList();
var sonarrEpCount = sonarrEpisodeList.Count;
var ourRequestCount = season.Episodes.Count;
@@ -356,15 +368,7 @@ namespace Ombi.Core.Senders
//// NOTE, not sure if needed since ombi ui displays future episodes anyway...
//ourEpisodes.AddRange(unairedEpisodes);
//var distinctEpisodes = ourEpisodes.Distinct().ToList();
- //var missingEpisodes = Enumerable.Range(distinctEpisodes.Min(), distinctEpisodes.Count).Except(distinctEpisodes);
-
- var existingSeason =
- result.seasons.FirstOrDefault(x => x.seasonNumber == season.SeasonNumber);
- if (existingSeason == null)
- {
- Logger.LogError("There was no season numer {0} in Sonarr for title {1}", season.SeasonNumber, model.ParentRequest.Title);
- continue;
- }
+ //var missingEpisodes = Enumerable.Range(distinctEpisodes.Min(), distinctEpisodes.Count).Except(distinctEpisodes);
if (sonarrEpCount == ourRequestCount /*|| !missingEpisodes.Any()*/)
diff --git a/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj b/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj
index 9d6efcd69..e65f2d5a2 100644
--- a/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj
+++ b/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
@@ -11,10 +11,10 @@
-
+
-
-
+
+
diff --git a/src/Ombi.HealthChecks/Ombi.HealthChecks.csproj b/src/Ombi.HealthChecks/Ombi.HealthChecks.csproj
index 1abcc9a8d..e228dd0d2 100644
--- a/src/Ombi.HealthChecks/Ombi.HealthChecks.csproj
+++ b/src/Ombi.HealthChecks/Ombi.HealthChecks.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Helpers.Tests/Ombi.Helpers.Tests.csproj b/src/Ombi.Helpers.Tests/Ombi.Helpers.Tests.csproj
index 53725b2b0..370440d1c 100644
--- a/src/Ombi.Helpers.Tests/Ombi.Helpers.Tests.csproj
+++ b/src/Ombi.Helpers.Tests/Ombi.Helpers.Tests.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
false
@@ -10,7 +10,7 @@
-
+
diff --git a/src/Ombi.Helpers/JobDataKeys.cs b/src/Ombi.Helpers/JobDataKeys.cs
index e0e2f7451..277834431 100644
--- a/src/Ombi.Helpers/JobDataKeys.cs
+++ b/src/Ombi.Helpers/JobDataKeys.cs
@@ -3,6 +3,7 @@
public class JobDataKeys
{
public const string RecentlyAddedSearch = "recentlyAddedSearch";
+ public const string EmbyRecentlyAddedSearch = nameof(EmbyRecentlyAddedSearch);
public const string NotificationOptions = nameof(NotificationOptions);
}
}
\ No newline at end of file
diff --git a/src/Ombi.Helpers/LinqHelpers.cs b/src/Ombi.Helpers/LinqHelpers.cs
index af8d44633..4e8012653 100644
--- a/src/Ombi.Helpers/LinqHelpers.cs
+++ b/src/Ombi.Helpers/LinqHelpers.cs
@@ -6,16 +6,6 @@ namespace Ombi.Helpers
{
public static class LinqHelpers
{
- public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector)
- {
- HashSet knownKeys = new HashSet();
- foreach (TSource source1 in source)
- {
- if (knownKeys.Add(keySelector(source1)))
- yield return source1;
- }
- }
-
public static HashSet ToHashSet(
this IEnumerable source,
IEqualityComparer comparer = null)
diff --git a/src/Ombi.Helpers/MediaCacheService.cs b/src/Ombi.Helpers/MediaCacheService.cs
index d99090b62..8d244f4b3 100644
--- a/src/Ombi.Helpers/MediaCacheService.cs
+++ b/src/Ombi.Helpers/MediaCacheService.cs
@@ -53,17 +53,18 @@ namespace Ombi.Helpers
_memoryCache.Set(CacheKey, mediaServiceCache);
}
- public async Task Purge()
+ public Task Purge()
{
var keys = _memoryCache.Get>(CacheKey);
if (keys == null)
{
- return;
+ return Task.CompletedTask;
}
foreach (var key in keys)
{
base.Remove(key);
}
+ return Task.CompletedTask;
}
}
diff --git a/src/Ombi.Helpers/NotificationSubstitues.cs b/src/Ombi.Helpers/NotificationSubstitues.cs
new file mode 100644
index 000000000..69b91304d
--- /dev/null
+++ b/src/Ombi.Helpers/NotificationSubstitues.cs
@@ -0,0 +1,18 @@
+namespace Ombi.Helpers
+{
+ public static class NotificationSubstitues
+ {
+ public const string Title = nameof(Title);
+ public const string IssueDescription = nameof(IssueDescription);
+ public const string IssueCategory = nameof(IssueCategory);
+ public const string IssueStatus = nameof(IssueStatus);
+ public const string IssueSubject = nameof(IssueSubject);
+ public const string IssueUser = nameof(IssueUser);
+ public const string IssueUserAlias = nameof(IssueUserAlias);
+ public const string RequestType = nameof(RequestType);
+ public const string PosterPath = nameof(PosterPath);
+ public const string NewIssueComment = nameof(NewIssueComment);
+ public const string IssueId = nameof(IssueId);
+ public const string AdminComment = nameof(AdminComment);
+ }
+}
diff --git a/src/Ombi.Helpers/Ombi.Helpers.csproj b/src/Ombi.Helpers/Ombi.Helpers.csproj
index 2c32cc1bc..afc881d94 100644
--- a/src/Ombi.Helpers/Ombi.Helpers.csproj
+++ b/src/Ombi.Helpers/Ombi.Helpers.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/src/Ombi.Hubs/Ombi.Hubs.csproj b/src/Ombi.Hubs/Ombi.Hubs.csproj
index 613221552..fc65e2dc2 100644
--- a/src/Ombi.Hubs/Ombi.Hubs.csproj
+++ b/src/Ombi.Hubs/Ombi.Hubs.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
8.0
Debug;Release;NonUiBuild
diff --git a/src/Ombi.Mapping/Ombi.Mapping.csproj b/src/Ombi.Mapping/Ombi.Mapping.csproj
index f6a5194d9..9ad1f1135 100644
--- a/src/Ombi.Mapping/Ombi.Mapping.csproj
+++ b/src/Ombi.Mapping/Ombi.Mapping.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Notifications.Templates/EmailBasicTemplate.cs b/src/Ombi.Notifications.Templates/EmailBasicTemplate.cs
index 15ec9b286..455c2d182 100644
--- a/src/Ombi.Notifications.Templates/EmailBasicTemplate.cs
+++ b/src/Ombi.Notifications.Templates/EmailBasicTemplate.cs
@@ -13,7 +13,7 @@ namespace Ombi.Notifications.Templates
if (string.IsNullOrEmpty(_templateLocation))
{
#if DEBUG
- _templateLocation = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Debug", "net5.0", "Templates",
+ _templateLocation = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Debug", "net6.0", "Templates",
"BasicTemplate.html");
#else
_templateLocation = Path.Combine(Directory.GetCurrentDirectory(), "Templates","BasicTemplate.html");
diff --git a/src/Ombi.Notifications.Templates/NewsletterTemplate.cs b/src/Ombi.Notifications.Templates/NewsletterTemplate.cs
index f2f0cbf12..ef31dfc4c 100644
--- a/src/Ombi.Notifications.Templates/NewsletterTemplate.cs
+++ b/src/Ombi.Notifications.Templates/NewsletterTemplate.cs
@@ -13,7 +13,7 @@ namespace Ombi.Notifications.Templates
if (string.IsNullOrEmpty(_templateLocation))
{
#if DEBUG
- _templateLocation = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Debug", "net5.0", "Templates", "NewsletterTemplate.html");
+ _templateLocation = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Debug", "net6.0", "Templates", "NewsletterTemplate.html");
#else
_templateLocation = Path.Combine(Directory.GetCurrentDirectory(), "Templates", "NewsletterTemplate.html");
#endif
diff --git a/src/Ombi.Notifications.Templates/Ombi.Notifications.Templates.csproj b/src/Ombi.Notifications.Templates/Ombi.Notifications.Templates.csproj
index 47f701083..33088a591 100644
--- a/src/Ombi.Notifications.Templates/Ombi.Notifications.Templates.csproj
+++ b/src/Ombi.Notifications.Templates/Ombi.Notifications.Templates.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
3.0.0.0
3.0.0.0
diff --git a/src/Ombi.Notifications.Tests/NotificationMessageCurlysTests.cs b/src/Ombi.Notifications.Tests/NotificationMessageCurlysTests.cs
index 960e552df..783844a82 100644
--- a/src/Ombi.Notifications.Tests/NotificationMessageCurlysTests.cs
+++ b/src/Ombi.Notifications.Tests/NotificationMessageCurlysTests.cs
@@ -76,6 +76,7 @@ namespace Ombi.Notifications.Tests
{ "IssueUser", "User" },
{ "IssueUserAlias", "alias" },
{ "RequestType", "Movie" },
+ { "PosterPath", "aaaaa" }
}
};
var req = F.Build()
@@ -94,6 +95,39 @@ namespace Ombi.Notifications.Tests
Assert.That("Movie", Is.EqualTo(sut.Type));
}
+ [Test]
+ public void IssueNotificationTests_NoRequest()
+ {
+ var notificationOptions = new NotificationOptions
+ {
+ Substitutes = new Dictionary
+ {
+ { "IssueDescription", "Desc" },
+ { "IssueCategory", "Cat" },
+ { "IssueStatus", "state" },
+ { "IssueSubject", "sub" },
+ { "NewIssueComment", "a" },
+ { "IssueUser", "User" },
+ { "IssueUserAlias", "alias" },
+ { "RequestType", "Movie" },
+ { "PosterPath", "aaaaa" }
+ }
+ };
+
+ var customization = new CustomizationSettings();
+ var userPrefs = new UserNotificationPreferences();
+ sut.Setup(notificationOptions, (MovieRequests)null, customization, userPrefs);
+
+ Assert.That("Desc", Is.EqualTo(sut.IssueDescription));
+ Assert.That("Cat", Is.EqualTo(sut.IssueCategory));
+ Assert.That("state", Is.EqualTo(sut.IssueStatus));
+ Assert.That("a", Is.EqualTo(sut.NewIssueComment));
+ Assert.That("User", Is.EqualTo(sut.UserName));
+ Assert.That("alias", Is.EqualTo(sut.Alias));
+ Assert.That("Movie", Is.EqualTo(sut.Type));
+ Assert.That("https://image.tmdb.org/t/p/w300/aaaaa", Is.EqualTo(sut.PosterImage));
+ }
+
[Test]
public void MovieNotificationUserPreferences()
{
diff --git a/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj b/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj
index 495df8cdc..b3edbcf6d 100644
--- a/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj
+++ b/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
Debug;Release;NonUiBuild
@@ -10,7 +10,7 @@
-
+
diff --git a/src/Ombi.Notifications/Agents/DiscordNotification.cs b/src/Ombi.Notifications/Agents/DiscordNotification.cs
index 0cc0c9b89..ae344116f 100644
--- a/src/Ombi.Notifications/Agents/DiscordNotification.cs
+++ b/src/Ombi.Notifications/Agents/DiscordNotification.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Ombi.Api.Discord;
using Ombi.Api.Discord.Models;
@@ -21,8 +22,8 @@ namespace Ombi.Notifications.Agents
public DiscordNotification(IDiscordApi api, ISettingsService sn,
ILogger log, INotificationTemplatesRepository r,
IMovieRequestRepository m, ITvRequestRepository t, ISettingsService s, IRepository sub, IMusicRequestRepository music,
- IRepository userPref)
- : base(sn, r, m, t, s, log, sub, music, userPref)
+ IRepository userPref, UserManager um)
+ : base(sn, r, m, t, s, log, sub, music, userPref, um)
{
Api = api;
Logger = log;
diff --git a/src/Ombi.Notifications/Agents/EmailNotification.cs b/src/Ombi.Notifications/Agents/EmailNotification.cs
index f41406d0e..cb96fcdb6 100644
--- a/src/Ombi.Notifications/Agents/EmailNotification.cs
+++ b/src/Ombi.Notifications/Agents/EmailNotification.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MailKit.Net.Smtp;
@@ -22,7 +23,7 @@ namespace Ombi.Notifications.Agents
{
public EmailNotification(ISettingsService settings, INotificationTemplatesRepository r, IMovieRequestRepository m, ITvRequestRepository t, IEmailProvider prov, ISettingsService c,
ILogger log, UserManager um, IRepository sub, IMusicRequestRepository music,
- IRepository userPref) : base(settings, r, m, t, c, log, sub, music, userPref)
+ IRepository userPref) : base(settings, r, m, t, c, log, sub, music, userPref, um)
{
EmailProvider = prov;
Logger = log;
@@ -114,7 +115,15 @@ namespace Ombi.Notifications.Agents
var plaintext = await LoadPlainTextMessage(NotificationType.NewRequest, model, settings);
message.Other.Add("PlainTextBody", plaintext);
- await Send(message, settings);
+ foreach (var recipient in (await GetPrivilegedUsers()).DistinctBy(x => x.Email))
+ {
+ if (recipient.Email.IsNullOrEmpty())
+ {
+ continue;
+ }
+ message.To = recipient.Email;
+ await Send(message, settings);
+ }
}
protected override async Task NewIssue(NotificationOptions model, EmailNotificationSettings settings)
diff --git a/src/Ombi.Notifications/Agents/GotifyNotification.cs b/src/Ombi.Notifications/Agents/GotifyNotification.cs
index 00b62c343..e948c4d89 100644
--- a/src/Ombi.Notifications/Agents/GotifyNotification.cs
+++ b/src/Ombi.Notifications/Agents/GotifyNotification.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Ombi.Api.Gotify;
using Ombi.Core.Settings;
@@ -17,7 +18,7 @@ namespace Ombi.Notifications.Agents
{
public GotifyNotification(IGotifyApi api, ISettingsService sn, ILogger log, INotificationTemplatesRepository r, IMovieRequestRepository m, ITvRequestRepository t,
ISettingsService s, IRepository sub, IMusicRequestRepository music,
- IRepository userPref) : base(sn, r, m, t, s, log, sub, music, userPref)
+ IRepository userPref, UserManager um) : base(sn, r, m, t, s, log, sub, music, userPref, um)
{
Api = api;
Logger = log;
diff --git a/src/Ombi.Notifications/Agents/LegacyMobileNotification.cs b/src/Ombi.Notifications/Agents/LegacyMobileNotification.cs
index c2d71e0d0..9df7c6a94 100644
--- a/src/Ombi.Notifications/Agents/LegacyMobileNotification.cs
+++ b/src/Ombi.Notifications/Agents/LegacyMobileNotification.cs
@@ -23,7 +23,7 @@ namespace Ombi.Notifications.Agents
public LegacyMobileNotification(IOneSignalApi api, ISettingsService sn, ILogger log, INotificationTemplatesRepository r,
IMovieRequestRepository m, ITvRequestRepository t, ISettingsService s, IRepository notification,
UserManager um, IRepository sub, IMusicRequestRepository music, IRepository issueRepository,
- IRepository userPref) : base(sn, r, m, t, s, log, sub, music, userPref)
+ IRepository userPref) : base(sn, r, m, t, s, log, sub, music, userPref, um)
{
_api = api;
_logger = log;
@@ -59,7 +59,7 @@ namespace Ombi.Notifications.Agents
};
// Get admin devices
- var playerIds = await GetAdmins(NotificationType.NewRequest);
+ var playerIds = await GetPrivilegedUsersPlayerIds();
await Send(playerIds, notification, settings, model, true);
}
@@ -77,7 +77,7 @@ namespace Ombi.Notifications.Agents
};
// Get admin devices
- var playerIds = await GetAdmins(NotificationType.Issue);
+ var playerIds = await GetAdmins();
await Send(playerIds, notification, settings, model);
}
@@ -106,7 +106,7 @@ namespace Ombi.Notifications.Agents
else
{
// Send to admin
- var playerIds = await GetAdmins(NotificationType.IssueComment);
+ var playerIds = await GetAdmins();
await Send(playerIds, notification, settings, model);
}
}
@@ -147,7 +147,7 @@ namespace Ombi.Notifications.Agents
};
// Get admin devices
- var playerIds = await GetAdmins(NotificationType.Test);
+ var playerIds = await GetAdmins();
await Send(playerIds, notification, settings, model);
}
@@ -241,15 +241,25 @@ namespace Ombi.Notifications.Agents
await Send(playerIds, notification, settings, model);
}
- private async Task> GetAdmins(NotificationType type)
+ private async Task> GetAdmins()
{
- var adminUsers = (await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin)).Select(x => x.Id).ToList();
+ return await GetNotificationRecipients(await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin));
+ }
+ private async Task> GetPrivilegedUsersPlayerIds()
+ {
+ return await GetNotificationRecipients(await GetPrivilegedUsers());
+ }
+
+ private async Task> GetNotificationRecipients(IEnumerable users)
+ {
+
+ var adminUsers = users.Select(x => x.Id).ToList();
var notificationUsers = _notifications.GetAll().Include(x => x.User).Where(x => adminUsers.Contains(x.UserId));
var playerIds = await notificationUsers.Select(x => x.PlayerId).ToListAsync();
if (!playerIds.Any())
{
_logger.LogInformation(
- $"there are no admins to send a notification for {type}, for agent {NotificationAgent.Mobile}");
+ $"there are no users to send a notification for agent {NotificationAgent.Mobile}");
return null;
}
return playerIds;
diff --git a/src/Ombi.Notifications/Agents/MattermostNotification.cs b/src/Ombi.Notifications/Agents/MattermostNotification.cs
index 39e87e334..4b5b570c7 100644
--- a/src/Ombi.Notifications/Agents/MattermostNotification.cs
+++ b/src/Ombi.Notifications/Agents/MattermostNotification.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Ombi.Api.Mattermost;
using Ombi.Api.Mattermost.Models;
@@ -19,7 +20,7 @@ namespace Ombi.Notifications.Agents
{
public MattermostNotification(IMattermostApi api, ISettingsService sn, ILogger log, INotificationTemplatesRepository r, IMovieRequestRepository m, ITvRequestRepository t,
ISettingsService s, IRepository sub, IMusicRequestRepository music,
- IRepository userPref) : base(sn, r, m, t, s, log, sub, music, userPref)
+ IRepository userPref, UserManager um) : base(sn, r, m, t, s, log, sub, music, userPref, um)
{
Api = api;
Logger = log;
diff --git a/src/Ombi.Notifications/Agents/MobileNotification.cs b/src/Ombi.Notifications/Agents/MobileNotification.cs
index b7ada4838..0d21f39a5 100644
--- a/src/Ombi.Notifications/Agents/MobileNotification.cs
+++ b/src/Ombi.Notifications/Agents/MobileNotification.cs
@@ -23,7 +23,7 @@ namespace Ombi.Notifications.Agents
public MobileNotification(ICloudMobileNotification api, ISettingsService sn, ILogger log, INotificationTemplatesRepository r,
IMovieRequestRepository m, ITvRequestRepository t, ISettingsService s, IRepository notification,
UserManager um, IRepository sub, IMusicRequestRepository music, IRepository issueRepository,
- IRepository userPref) : base(sn, r, m, t, s, log, sub, music, userPref)
+ IRepository userPref) : base(sn, r, m, t, s, log, sub, music, userPref, um)
{
_api = api;
_logger = log;
@@ -62,7 +62,7 @@ namespace Ombi.Notifications.Agents
};
// Get admin devices
- var playerIds = await GetAdmins(NotificationType.NewRequest);
+ var playerIds = await GetPrivilegedUsersPlayerIds();
await Send(playerIds, notification, settings, model, true);
}
@@ -82,7 +82,7 @@ namespace Ombi.Notifications.Agents
};
// Get admin devices
- var playerIds = await GetAdmins(NotificationType.Issue);
+ var playerIds = await GetAdmins();
await Send(playerIds, notification, settings, model);
}
@@ -112,7 +112,7 @@ namespace Ombi.Notifications.Agents
else
{
// Send to admin
- var playerIds = await GetAdmins(NotificationType.IssueComment);
+ var playerIds = await GetAdmins();
await Send(playerIds, notification, settings, model);
}
}
@@ -157,7 +157,7 @@ namespace Ombi.Notifications.Agents
};
// Get admin devices
- var playerIds = await GetAdmins(NotificationType.Test);
+ var playerIds = await GetAdmins();
await Send(playerIds, notification, settings, model);
}
@@ -279,15 +279,25 @@ namespace Ombi.Notifications.Agents
await Send(playerIds, notification, settings, model);
}
- private async Task> GetAdmins(NotificationType type)
+ private async Task> GetAdmins()
{
- var adminUsers = (await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin)).Select(x => x.Id).ToList();
+ return await GetNotificationRecipients(await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin));
+ }
+ private async Task> GetPrivilegedUsersPlayerIds()
+ {
+ return await GetNotificationRecipients(await GetPrivilegedUsers());
+ }
+
+ private async Task> GetNotificationRecipients(IEnumerable users)
+ {
+
+ var adminUsers = users.Select(x => x.Id).ToList();
var notificationUsers = _notifications.GetAll().Include(x => x.User).Where(x => adminUsers.Contains(x.UserId));
var playerIds = await notificationUsers.Select(x => x.Token).ToListAsync();
if (!playerIds.Any())
{
_logger.LogInformation(
- $"there are no admins to send a notification for {type}, for agent {NotificationAgent.Mobile}");
+ $"there are no users to send a notification for agent {NotificationAgent.Mobile}");
return null;
}
return playerIds;
@@ -377,7 +387,7 @@ namespace Ombi.Notifications.Agents
};
// Get admin devices
- var playerIds = await GetAdmins(NotificationType.PartiallyAvailable);
+ var playerIds = await GetAdmins();
await Send(playerIds, notification, settings, model, true);
}
}
diff --git a/src/Ombi.Notifications/Agents/PushbulletNotification.cs b/src/Ombi.Notifications/Agents/PushbulletNotification.cs
index fd4be12a2..3823afe13 100644
--- a/src/Ombi.Notifications/Agents/PushbulletNotification.cs
+++ b/src/Ombi.Notifications/Agents/PushbulletNotification.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Ombi.Api.Pushbullet;
using Ombi.Core.Settings;
@@ -17,7 +18,7 @@ namespace Ombi.Notifications.Agents
{
public PushbulletNotification(IPushbulletApi api, ISettingsService sn, ILogger log, INotificationTemplatesRepository r, IMovieRequestRepository m, ITvRequestRepository t,
ISettingsService s, IRepository sub, IMusicRequestRepository music,
- IRepository userPref) : base(sn, r, m, t, s, log, sub, music, userPref)
+ IRepository userPref, UserManager um) : base(sn, r, m, t, s, log, sub, music, userPref, um)
{
Api = api;
Logger = log;
diff --git a/src/Ombi.Notifications/Agents/PushoverNotification.cs b/src/Ombi.Notifications/Agents/PushoverNotification.cs
index 21352b8d6..3edcd62e2 100644
--- a/src/Ombi.Notifications/Agents/PushoverNotification.cs
+++ b/src/Ombi.Notifications/Agents/PushoverNotification.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Ombi.Api.Pushbullet;
using Ombi.Api.Pushover;
@@ -18,7 +19,7 @@ namespace Ombi.Notifications.Agents
{
public PushoverNotification(IPushoverApi api, ISettingsService sn, ILogger log, INotificationTemplatesRepository r, IMovieRequestRepository m, ITvRequestRepository t,
ISettingsService s, IRepository sub, IMusicRequestRepository music,
- IRepository userPref) : base(sn, r, m, t, s, log, sub, music, userPref)
+ IRepository userPref, UserManager um) : base(sn, r, m, t, s, log, sub, music, userPref, um)
{
Api = api;
Logger = log;
diff --git a/src/Ombi.Notifications/Agents/SlackNotification.cs b/src/Ombi.Notifications/Agents/SlackNotification.cs
index 8dbf14a7d..7ea5b628a 100644
--- a/src/Ombi.Notifications/Agents/SlackNotification.cs
+++ b/src/Ombi.Notifications/Agents/SlackNotification.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Ombi.Api.Slack;
using Ombi.Api.Slack.Models;
@@ -18,7 +19,7 @@ namespace Ombi.Notifications.Agents
{
public SlackNotification(ISlackApi api, ISettingsService sn, ILogger log, INotificationTemplatesRepository r, IMovieRequestRepository m, ITvRequestRepository t,
ISettingsService |