mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
fixed #1826
This commit is contained in:
parent
3a404f0cc0
commit
ab754e1db0
1 changed files with 30 additions and 2 deletions
|
@ -29,6 +29,7 @@ using Ombi.Schedule.Jobs.Ombi;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Settings.Settings.Models.Notifications;
|
using Ombi.Settings.Settings.Models.Notifications;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
|
using Ombi.Store.Entities.Requests;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
using Ombi.Store.Repository.Requests;
|
using Ombi.Store.Repository.Requests;
|
||||||
using IdentityResult = Microsoft.AspNetCore.Identity.IdentityResult;
|
using IdentityResult = Microsoft.AspNetCore.Identity.IdentityResult;
|
||||||
|
@ -52,7 +53,10 @@ namespace Ombi.Controllers
|
||||||
ITvRequestRepository t,
|
ITvRequestRepository t,
|
||||||
ILogger<IdentityController> l,
|
ILogger<IdentityController> l,
|
||||||
IPlexApi plexApi,
|
IPlexApi plexApi,
|
||||||
ISettingsService<PlexSettings> settings)
|
ISettingsService<PlexSettings> settings,
|
||||||
|
IRepository<RequestLog> requestLog,
|
||||||
|
IRepository<Issues> issues,
|
||||||
|
IRepository<IssueComments> issueComments)
|
||||||
{
|
{
|
||||||
UserManager = user;
|
UserManager = user;
|
||||||
Mapper = mapper;
|
Mapper = mapper;
|
||||||
|
@ -66,6 +70,9 @@ namespace Ombi.Controllers
|
||||||
_log = l;
|
_log = l;
|
||||||
_plexApi = plexApi;
|
_plexApi = plexApi;
|
||||||
_plexSettings = settings;
|
_plexSettings = settings;
|
||||||
|
_issuesRepository = issues;
|
||||||
|
_requestLogRepository = requestLog;
|
||||||
|
_issueCommentsRepository = issueComments;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OmbiUserManager UserManager { get; }
|
private OmbiUserManager UserManager { get; }
|
||||||
|
@ -80,6 +87,10 @@ namespace Ombi.Controllers
|
||||||
private readonly ILogger<IdentityController> _log;
|
private readonly ILogger<IdentityController> _log;
|
||||||
private readonly IPlexApi _plexApi;
|
private readonly IPlexApi _plexApi;
|
||||||
private readonly ISettingsService<PlexSettings> _plexSettings;
|
private readonly ISettingsService<PlexSettings> _plexSettings;
|
||||||
|
private readonly IRepository<Issues> _issuesRepository;
|
||||||
|
private readonly IRepository<IssueComments> _issueCommentsRepository;
|
||||||
|
private readonly IRepository<RequestLog> _requestLogRepository;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is what the Wizard will call when creating the user for the very first time.
|
/// This is what the Wizard will call when creating the user for the very first time.
|
||||||
|
@ -520,6 +531,23 @@ namespace Ombi.Controllers
|
||||||
await TvRepo.DeleteChildRange(tvUserRequested);
|
await TvRepo.DeleteChildRange(tvUserRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete any issues and request logs
|
||||||
|
var issues = _issuesRepository.GetAll().Where(x => x.UserReportedId == userId);
|
||||||
|
var issueComments = _issueCommentsRepository.GetAll().Where(x => x.UserId == userId);
|
||||||
|
var requestLog = _requestLogRepository.GetAll().Where(x => x.UserId == userId);
|
||||||
|
if (issues.Any())
|
||||||
|
{
|
||||||
|
await _issuesRepository.DeleteRange(issues);
|
||||||
|
}
|
||||||
|
if (requestLog.Any())
|
||||||
|
{
|
||||||
|
await _requestLogRepository.DeleteRange(requestLog);
|
||||||
|
}
|
||||||
|
if (issueComments.Any())
|
||||||
|
{
|
||||||
|
await _issueCommentsRepository.DeleteRange(issueComments);
|
||||||
|
}
|
||||||
|
|
||||||
var result = await UserManager.DeleteAsync(userToDelete);
|
var result = await UserManager.DeleteAsync(userToDelete);
|
||||||
if (result.Succeeded)
|
if (result.Succeeded)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue