Clean up user deletion

This commit is contained in:
Patrick Barron 2021-03-25 19:49:52 -04:00
parent a7b29e2fe0
commit 7364155579

View File

@ -257,16 +257,6 @@ namespace Jellyfin.Server.Implementations.Users
} }
await using var dbContext = _dbProvider.CreateContext(); await using var dbContext = _dbProvider.CreateContext();
// Clear all entities related to the user from the database.
if (user.ProfileImage != null)
{
dbContext.Remove(user.ProfileImage);
}
dbContext.RemoveRange(user.Permissions);
dbContext.RemoveRange(user.Preferences);
dbContext.RemoveRange(user.AccessSchedules);
dbContext.Users.Remove(user); dbContext.Users.Remove(user);
await dbContext.SaveChangesAsync().ConfigureAwait(false); await dbContext.SaveChangesAsync().ConfigureAwait(false);
_users.Remove(userId); _users.Remove(userId);