소스 검색

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