瀏覽代碼

Use ExecuteDelete for removing API keys

Patrick Barron 1 年之前
父節點
當前提交
ad58d1f77c
共有 1 個文件被更改,包括 2 次插入11 次删除
  1. 2 11
      Jellyfin.Server.Implementations/Security/AuthenticationManager.cs

+ 2 - 11
Jellyfin.Server.Implementations/Security/AuthenticationManager.cs

@@ -58,19 +58,10 @@ namespace Jellyfin.Server.Implementations.Security
             var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
             await using (dbContext.ConfigureAwait(false))
             {
-                var key = await dbContext.ApiKeys
+                await dbContext.ApiKeys
                     .Where(apiKey => apiKey.AccessToken == accessToken)
-                    .FirstOrDefaultAsync()
+                    .ExecuteDeleteAsync()
                     .ConfigureAwait(false);
-
-                if (key is null)
-                {
-                    return;
-                }
-
-                dbContext.Remove(key);
-
-                await dbContext.SaveChangesAsync().ConfigureAwait(false);
             }
         }
     }