Actually fix deleting profile images (hopefully)

pull/3148/head
Patrick Barron 4 years ago
parent d0e2027b05
commit 103c9b7162

@ -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; }

@ -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)

Loading…
Cancel
Save