mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Fixed the issue where you could not delete a user #2365
This commit is contained in:
parent
3f729089c8
commit
acf604305b
1 changed files with 20 additions and 1 deletions
|
@ -57,7 +57,9 @@ namespace Ombi.Controllers
|
||||||
ISettingsService<PlexSettings> settings,
|
ISettingsService<PlexSettings> settings,
|
||||||
IRepository<RequestLog> requestLog,
|
IRepository<RequestLog> requestLog,
|
||||||
IRepository<Issues> issues,
|
IRepository<Issues> issues,
|
||||||
IRepository<IssueComments> issueComments)
|
IRepository<IssueComments> issueComments,
|
||||||
|
IRepository<NotificationUserId> notificationRepository,
|
||||||
|
IRepository<RequestSubscription> subscriptionRepository)
|
||||||
{
|
{
|
||||||
UserManager = user;
|
UserManager = user;
|
||||||
Mapper = mapper;
|
Mapper = mapper;
|
||||||
|
@ -75,6 +77,8 @@ namespace Ombi.Controllers
|
||||||
_requestLogRepository = requestLog;
|
_requestLogRepository = requestLog;
|
||||||
_issueCommentsRepository = issueComments;
|
_issueCommentsRepository = issueComments;
|
||||||
OmbiSettings = ombiSettings;
|
OmbiSettings = ombiSettings;
|
||||||
|
_requestSubscriptionRepository = subscriptionRepository;
|
||||||
|
_notificationRepository = notificationRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OmbiUserManager UserManager { get; }
|
private OmbiUserManager UserManager { get; }
|
||||||
|
@ -93,6 +97,8 @@ namespace Ombi.Controllers
|
||||||
private readonly IRepository<Issues> _issuesRepository;
|
private readonly IRepository<Issues> _issuesRepository;
|
||||||
private readonly IRepository<IssueComments> _issueCommentsRepository;
|
private readonly IRepository<IssueComments> _issueCommentsRepository;
|
||||||
private readonly IRepository<RequestLog> _requestLogRepository;
|
private readonly IRepository<RequestLog> _requestLogRepository;
|
||||||
|
private readonly IRepository<NotificationUserId> _notificationRepository;
|
||||||
|
private readonly IRepository<RequestSubscription> _requestSubscriptionRepository;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -569,6 +575,19 @@ namespace Ombi.Controllers
|
||||||
await _issueCommentsRepository.DeleteRange(issueComments);
|
await _issueCommentsRepository.DeleteRange(issueComments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete the Subscriptions and mobile notification ids
|
||||||
|
var subs = _requestSubscriptionRepository.GetAll().Where(x => x.UserId == userId);
|
||||||
|
var mobileIds = _notificationRepository.GetAll().Where(x => x.UserId == userId);
|
||||||
|
if (subs.Any())
|
||||||
|
{
|
||||||
|
await _requestSubscriptionRepository.DeleteRange(subs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mobileIds.Any())
|
||||||
|
{
|
||||||
|
await _notificationRepository.DeleteRange(mobileIds);
|
||||||
|
}
|
||||||
|
|
||||||
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