Actually fix deleting profile images (hopefully)

This commit is contained in:
Patrick Barron 2020-06-12 22:47:09 -04:00
parent d0e2027b05
commit 103c9b7162
2 changed files with 7 additions and 6 deletions

View File

@ -23,8 +23,12 @@ namespace Jellyfin.Server.Implementations
/// </summary>
public static string ConnectionString { get; set; } = @"Data Source=jellyfin.db";
public virtual DbSet<AccessSchedule> AccessSchedules { get; set; }
public virtual DbSet<ActivityLog> ActivityLogs { get; set; }
public virtual DbSet<ImageInfo> ImageInfos { get; set; }
public virtual DbSet<Permission> Permissions { get; set; }
public virtual DbSet<Preference> Preferences { get; set; }

View File

@ -670,12 +670,9 @@ namespace Jellyfin.Server.Implementations.Users
/// <inheritdoc/>
public void ClearProfileImage(User user)
{
#nullable disable
// TODO: Remove these when User has nullable annotations
// Can't just set the value to null, as it hasn't been loaded yet, so EF Core wouldn't see the change
_dbProvider.CreateContext().Entry(user).Reference(u => u.ProfileImage).CurrentValue = null;
#nullable enable
var dbContext = _dbProvider.CreateContext();
dbContext.ImageInfos.Remove(user.ProfileImage);
dbContext.SaveChanges();
}
private static bool IsValidUsername(string name)