diff --git a/.gitignore b/.gitignore index 1a2574bf5..1a1a229b8 100644 --- a/.gitignore +++ b/.gitignore @@ -248,3 +248,4 @@ _Pvt_Extensions *.vscode /src/Ombi/database.json /src/Ombi/healthchecksdb +/src/Ombi/ClientApp/package-lock.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 29b920feb..000000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: csharp -solution: src/Ombi.sln -install: - - mono Tools/nuget.exe restore Ombi.sln - - nuget install NUnit.Runners -OutputDirectory testrunner -script: - - xbuild /p:Configuration=Release Ombi.sln /p:TargetFrameworkVersion="v4.5" diff --git a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj index a629080a4..4f2662c76 100644 --- a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj +++ b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj @@ -2,16 +2,21 @@ netcoreapp3.1 + true + true - - - - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - + diff --git a/src/Ombi.Core.Tests/Rule/Search/EmbyAvailabilityRuleTests.cs b/src/Ombi.Core.Tests/Rule/Search/EmbyAvailabilityRuleTests.cs index 5cac19383..ca4b9a056 100644 --- a/src/Ombi.Core.Tests/Rule/Search/EmbyAvailabilityRuleTests.cs +++ b/src/Ombi.Core.Tests/Rule/Search/EmbyAvailabilityRuleTests.cs @@ -70,7 +70,7 @@ namespace Ombi.Core.Tests.Rule.Search var result = await Rule.Execute(search); Assert.True(result.Success); - Assert.That(search.EmbyUrl, Is.EqualTo("http://test.com/#!/item/item.html?id=1")); + Assert.That(search.EmbyUrl, Is.EqualTo("http://test.com/#!/item.html?id=1")); } [Test] @@ -99,7 +99,7 @@ namespace Ombi.Core.Tests.Rule.Search var result = await Rule.Execute(search); Assert.True(result.Success); - Assert.That(search.EmbyUrl, Is.EqualTo("https://app.emby.media/#!/item/item.html?id=1")); + Assert.That(search.EmbyUrl, Is.EqualTo("https://app.emby.media/#!/item.html?id=1")); } [Test] diff --git a/src/Ombi.Core.Tests/Rule/Search/LidarrAlbumCacheRuleTests.cs b/src/Ombi.Core.Tests/Rule/Search/LidarrAlbumCacheRuleTests.cs index 6b04a57b7..27dbee614 100644 --- a/src/Ombi.Core.Tests/Rule/Search/LidarrAlbumCacheRuleTests.cs +++ b/src/Ombi.Core.Tests/Rule/Search/LidarrAlbumCacheRuleTests.cs @@ -113,7 +113,7 @@ namespace Ombi.Core.Tests.Rule.Search PercentOfTracks = 100 } }.AsQueryable()); - var request = new SearchAlbumViewModel { ForeignAlbumId = "ABC" }; + var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" }; var result = await Rule.Execute(request); Assert.True(result.Success); diff --git a/src/Ombi.Core.Tests/Rule/Search/LidarrArtistCacheRuleTests.cs b/src/Ombi.Core.Tests/Rule/Search/LidarrArtistCacheRuleTests.cs index 7a2da1e25..c17400acb 100644 --- a/src/Ombi.Core.Tests/Rule/Search/LidarrArtistCacheRuleTests.cs +++ b/src/Ombi.Core.Tests/Rule/Search/LidarrArtistCacheRuleTests.cs @@ -63,7 +63,7 @@ namespace Ombi.Core.Tests.Rule.Search ForeignArtistId = "abc", } }.AsQueryable()); - var request = new SearchArtistViewModel { ForignArtistId = "ABC" }; + var request = new SearchArtistViewModel { ForignArtistId = "abc" }; var result = await Rule.Execute(request); Assert.True(result.Success); diff --git a/src/Ombi.Core/Engine/MovieRequestEngine.cs b/src/Ombi.Core/Engine/MovieRequestEngine.cs index 08c2f1a9f..79211c5ce 100644 --- a/src/Ombi.Core/Engine/MovieRequestEngine.cs +++ b/src/Ombi.Core/Engine/MovieRequestEngine.cs @@ -267,10 +267,10 @@ namespace Ombi.Core.Engine allRequests = allRequests.Where(x => x.Approved && !x.Available && (!x.Denied.HasValue || !x.Denied.Value)); break; case RequestStatus.Available: - allRequests = allRequests.Where(x => x.Available && (!x.Denied.HasValue || !x.Denied.Value)); + allRequests = allRequests.Where(x => x.Available); break; case RequestStatus.Denied: - allRequests = allRequests.Where(x => x.Denied.HasValue && x.Denied.Value); + allRequests = allRequests.Where(x => x.Denied.HasValue && x.Denied.Value && !x.Available); break; default: break; @@ -332,12 +332,11 @@ namespace Ombi.Core.Engine //var secondProp = TypeDescriptor.GetProperties(propType).Find(properties[1], true); } - allRequests = sortOrder.Equals("asc", StringComparison.InvariantCultureIgnoreCase) - ? allRequests.OrderBy(x => prop.GetValue(x)) - : allRequests.OrderByDescending(x => prop.GetValue(x)); - var total = await allRequests.CountAsync(); - var requests = await allRequests.Skip(position).Take(count) - .ToListAsync(); + var requests = (sortOrder.Equals("asc", StringComparison.InvariantCultureIgnoreCase) + ? allRequests.ToList().OrderBy(x => prop.GetValue(x)) + : allRequests.ToList().OrderByDescending(x => prop.GetValue(x))).ToList(); + var total = requests.Count(); + requests = requests.Skip(position).Take(count).ToList(); await CheckForSubscription(shouldHide, requests); return new RequestsViewModel diff --git a/src/Ombi.Store/Context/OmbiContext.cs b/src/Ombi.Store/Context/OmbiContext.cs index a8beecc68..2d06d4553 100644 --- a/src/Ombi.Store/Context/OmbiContext.cs +++ b/src/Ombi.Store/Context/OmbiContext.cs @@ -93,7 +93,7 @@ namespace Ombi.Store.Context } needToSave = true; - NotificationTemplates notificationToAdd; + NotificationTemplates notificationToAdd = null; switch (notificationType) { case NotificationType.NewRequest: @@ -159,14 +159,17 @@ namespace Ombi.Store.Context }; break; case NotificationType.WelcomeEmail: - notificationToAdd = new NotificationTemplates + if (agent == NotificationAgent.Email) { - NotificationType = notificationType, - Message = "Hello! You have been invited to use {ApplicationName}! You can login here: {ApplicationUrl}", - Subject = "Invite to {ApplicationName}", - Agent = agent, - Enabled = true, - }; + notificationToAdd = new NotificationTemplates + { + NotificationType = notificationType, + Message = "Hello! You have been invited to use {ApplicationName}! You can login here: {ApplicationUrl}", + Subject = "Invite to {ApplicationName}", + Agent = agent, + Enabled = true, + }; + } break; case NotificationType.IssueResolved: notificationToAdd = new NotificationTemplates @@ -204,7 +207,10 @@ namespace Ombi.Store.Context default: throw new ArgumentOutOfRangeException(); } - NotificationTemplates.Add(notificationToAdd); + if (notificationToAdd != null) + { + NotificationTemplates.Add(notificationToAdd); + } } } diff --git a/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.cs b/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.cs index 9dabefc00..a18e28270 100644 --- a/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.cs +++ b/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; +using System; namespace Ombi.Store.Migrations.OmbiMySql { @@ -8,15 +8,35 @@ namespace Ombi.Store.Migrations.OmbiMySql { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.Sql(@"CREATE TABLE `MobileDevices` ( - `Id` int NOT NULL AUTO_INCREMENT, - `Token` longtext CHARACTER SET utf8mb4 NULL, - `UserId` varchar(255) COLLATE utf8mb4_bin NOT NULL, - `AddedAt` datetime(6) NOT NULL, - CONSTRAINT `PK_MobileDevices` PRIMARY KEY (`Id`), - CONSTRAINT `FK_MobileDevices_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE RESTRICT -);"); - +// migrationBuilder.Sql(@"CREATE TABLE `MobileDevices` ( +// `Id` int NOT NULL AUTO_INCREMENT, +// `Token` longtext CHARACTER SET utf8mb4 NULL, +// `UserId` varchar(255) COLLATE utf8mb4_bin NOT NULL, +// `AddedAt` datetime(6) NOT NULL, +// CONSTRAINT `PK_MobileDevices` PRIMARY KEY (`Id`), +// CONSTRAINT `FK_MobileDevices_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `AspNetUsers` (`Id`) ON DELETE RESTRICT +//);"); + + migrationBuilder.CreateTable( + name: "MobileDevices", + columns: table => new + { + Id = table.Column(nullable: false).Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Token = table.Column(maxLength: 256, nullable: true), + UserId = table.Column(maxLength: 256, nullable: false), + AddedAt = table.Column(maxLength: 256, nullable: false), + }, + constraints: table => + { + table.PrimaryKey("PK_MobileDevices", x => x.Id); + table.ForeignKey( + name: "FK_MobileDevices_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateIndex( name: "IX_MobileDevices_UserId", diff --git a/src/Ombi/ClientApp/src/app/app.module.ts b/src/Ombi/ClientApp/src/app/app.module.ts index bffeac8f5..11e0d5e60 100644 --- a/src/Ombi/ClientApp/src/app/app.module.ts +++ b/src/Ombi/ClientApp/src/app/app.module.ts @@ -18,7 +18,8 @@ import { } from "primeng/primeng"; import { - MatButtonModule, MatNativeDateModule, MatIconModule, MatSidenavModule, MatListModule, MatToolbarModule, MatAutocompleteModule, MatCheckboxModule, MatSnackBarModule + MatButtonModule, MatNativeDateModule, MatIconModule, MatSidenavModule, MatListModule, MatToolbarModule, MatAutocompleteModule, MatCheckboxModule, MatSnackBarModule, + MatProgressSpinnerModule } from '@angular/material'; import { MatCardModule, MatInputModule, MatTabsModule, MatSlideToggleModule } from "@angular/material"; @@ -129,6 +130,7 @@ export function JwtTokenGetter() { CardsFreeModule, OverlayModule, MatCheckboxModule, + MatProgressSpinnerModule, MDBBootstrapModule.forRoot(), JwtModule.forRoot({ config: { diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts index a4e49a754..78a6d5822 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts @@ -196,9 +196,6 @@ export interface IAbout { ombiDatabaseType: string; externalDatabaseType: string; settingsDatabaseType: string; - ombiConnectionString: string; - externalConnectionString: string; - settingsConnectionString: string; storagePath: string; notSupported: boolean; } diff --git a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html index bf19ec5c4..4d03e8ef7 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html @@ -16,7 +16,7 @@
-
@@ -117,9 +117,9 @@ -
+
-
+