aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Users/UserManager.cs
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2020-06-11 17:51:02 -0400
committerPatrick Barron <barronpm@gmail.com>2020-06-11 17:51:02 -0400
commit7fba0b778ed7d1d8f8c5ff4e60945872319722c5 (patch)
tree186cce4b46d97c0a55043e5eb93dc1a0997139b4 /Jellyfin.Server.Implementations/Users/UserManager.cs
parenta194895e7a85a6c6bb6b2575d62e2dc0fcd1d303 (diff)
Properly remove profile images
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/UserManager.cs')
-rw-r--r--Jellyfin.Server.Implementations/Users/UserManager.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs
index d05fc2549..68f038ae8 100644
--- a/Jellyfin.Server.Implementations/Users/UserManager.cs
+++ b/Jellyfin.Server.Implementations/Users/UserManager.cs
@@ -22,7 +22,6 @@ using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Users;
-using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Server.Implementations.Users
@@ -668,6 +667,16 @@ namespace Jellyfin.Server.Implementations.Users
dbContext.SaveChanges();
}
+ 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
+ }
+
private static bool IsValidUsername(string name)
{
// This is some regex that matches only on unicode "word" characters, as well as -, _ and @