From 0ed2c014a84f8d25659ac928ea1037e00f3f457c Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Fri, 21 Feb 2020 21:24:51 +0000 Subject: [PATCH 1/2] Fixed duplicate key --- .../NotificationMessageCurlys.cs | 1 - src/Ombi/Controllers/V2/MobileController.cs | 23 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Notifications/NotificationMessageCurlys.cs b/src/Ombi.Notifications/NotificationMessageCurlys.cs index def74ea79..8140a4d3f 100644 --- a/src/Ombi.Notifications/NotificationMessageCurlys.cs +++ b/src/Ombi.Notifications/NotificationMessageCurlys.cs @@ -282,7 +282,6 @@ namespace Ombi.Notifications {nameof(UserPreference),UserPreference}, {nameof(DenyReason),DenyReason}, {nameof(AvailableDate),AvailableDate}, - {nameof(RequestId),RequestId}, }; } } \ No newline at end of file diff --git a/src/Ombi/Controllers/V2/MobileController.cs b/src/Ombi/Controllers/V2/MobileController.cs index be96faa98..f6185e18e 100644 --- a/src/Ombi/Controllers/V2/MobileController.cs +++ b/src/Ombi/Controllers/V2/MobileController.cs @@ -13,7 +13,7 @@ using System.Threading.Tasks; namespace Ombi.Controllers.V2 { - [ApiV2] + [ApiV2] [Authorize] [Produces("application/json")] [ApiController] @@ -56,5 +56,26 @@ namespace Ombi.Controllers.V2 } return BadRequest(); } + + [HttpDelete("Notification")] + [ApiExplorerSettings(IgnoreApi = true)] + [ProducesResponseType(400)] + [ProducesResponseType(200)] + public async Task RemoveNotifications() + { + + var user = await _userManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase)); + // Check if we already have this notification id + var currentDevices = await _mobileDevices.GetAll().Where(x => x.UserId == user.Id).ToListAsync(); + + if (currentDevices == null || !currentDevices.Any()) + { + return Ok(); + } + + await _mobileDevices.DeleteRange(currentDevices); + + return Ok(); + } } } From 4f9579e7bf3b32338f94e219440d5cb163249b2c Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Sun, 23 Feb 2020 20:54:49 +0000 Subject: [PATCH 2/2] Fixed #3405 --- src/Ombi.Core/Engine/Interfaces/BaseEngine.cs | 2 +- src/Ombi/ClientApp/src/app/interfaces/ISettings.ts | 2 +- src/Ombi/ClientApp/src/app/settings/radarr/radarr.component.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ombi.Core/Engine/Interfaces/BaseEngine.cs b/src/Ombi.Core/Engine/Interfaces/BaseEngine.cs index c5cb8c45a..81f35383a 100644 --- a/src/Ombi.Core/Engine/Interfaces/BaseEngine.cs +++ b/src/Ombi.Core/Engine/Interfaces/BaseEngine.cs @@ -29,7 +29,7 @@ namespace Ombi.Core.Engine.Interfaces private OmbiUser _user; protected async Task GetUser() { - return _user ?? (_user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(Username, StringComparison.CurrentCultureIgnoreCase))); + return _user ?? (_user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName == Username)); } protected async Task UserAlias() diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts index 8eb595a6c..a4e49a754 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts @@ -88,7 +88,7 @@ export interface ISonarrSettings extends IExternalSettings { export interface IRadarrSettings extends IExternalSettings { enabled: boolean; apiKey: string; - defaultQualityProfile: string; + defaultQualityProfile: number; defaultRootPath: string; fullRootPath: string; addOnly: boolean; diff --git a/src/Ombi/ClientApp/src/app/settings/radarr/radarr.component.ts b/src/Ombi/ClientApp/src/app/settings/radarr/radarr.component.ts index d68396a66..4f300de85 100644 --- a/src/Ombi/ClientApp/src/app/settings/radarr/radarr.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/radarr/radarr.component.ts @@ -34,7 +34,7 @@ export class RadarrComponent implements OnInit { this.form = this.fb.group({ enabled: [x.enabled], apiKey: [x.apiKey, [Validators.required]], - defaultQualityProfile: [x.defaultQualityProfile, [Validators.required]], + defaultQualityProfile: [+x.defaultQualityProfile, [Validators.required]], defaultRootPath: [x.defaultRootPath, [Validators.required]], ssl: [x.ssl], subDir: [x.subDir],