Merge branch 'feature/v4' of https://github.com/tidusjar/Ombi into feature/v4

pull/3528/head
tidusjar 5 years ago
commit c6b80c1218

@ -29,7 +29,7 @@ namespace Ombi.Core.Engine.Interfaces
private OmbiUser _user; private OmbiUser _user;
protected async Task<OmbiUser> GetUser() protected async Task<OmbiUser> 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<string> UserAlias() protected async Task<string> UserAlias()

@ -282,7 +282,6 @@ namespace Ombi.Notifications
{nameof(UserPreference),UserPreference}, {nameof(UserPreference),UserPreference},
{nameof(DenyReason),DenyReason}, {nameof(DenyReason),DenyReason},
{nameof(AvailableDate),AvailableDate}, {nameof(AvailableDate),AvailableDate},
{nameof(RequestId),RequestId},
}; };
} }
} }

@ -88,7 +88,7 @@ export interface ISonarrSettings extends IExternalSettings {
export interface IRadarrSettings extends IExternalSettings { export interface IRadarrSettings extends IExternalSettings {
enabled: boolean; enabled: boolean;
apiKey: string; apiKey: string;
defaultQualityProfile: string; defaultQualityProfile: number;
defaultRootPath: string; defaultRootPath: string;
fullRootPath: string; fullRootPath: string;
addOnly: boolean; addOnly: boolean;

@ -34,7 +34,7 @@ export class RadarrComponent implements OnInit {
this.form = this.fb.group({ this.form = this.fb.group({
enabled: [x.enabled], enabled: [x.enabled],
apiKey: [x.apiKey, [Validators.required]], apiKey: [x.apiKey, [Validators.required]],
defaultQualityProfile: [x.defaultQualityProfile, [Validators.required]], defaultQualityProfile: [+x.defaultQualityProfile, [Validators.required]],
defaultRootPath: [x.defaultRootPath, [Validators.required]], defaultRootPath: [x.defaultRootPath, [Validators.required]],
ssl: [x.ssl], ssl: [x.ssl],
subDir: [x.subDir], subDir: [x.subDir],

@ -13,7 +13,7 @@ using System.Threading.Tasks;
namespace Ombi.Controllers.V2 namespace Ombi.Controllers.V2
{ {
[ApiV2] [ApiV2]
[Authorize] [Authorize]
[Produces("application/json")] [Produces("application/json")]
[ApiController] [ApiController]
@ -56,5 +56,26 @@ namespace Ombi.Controllers.V2
} }
return BadRequest(); return BadRequest();
} }
[HttpDelete("Notification")]
[ApiExplorerSettings(IgnoreApi = true)]
[ProducesResponseType(400)]
[ProducesResponseType(200)]
public async Task<IActionResult> 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();
}
} }
} }

Loading…
Cancel
Save