The Free Software Media System - Server Backend & API
Convert UpdateUser to solely async
Patrick Barron3ebc0474343e
diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.csindex 1926e738f2..dd58ca8997 100644--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs@@ -457,10 +457,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings}StringBuilder str = new StringBuilder("[", 1 + (programIds.Count * 13));- foreach (ReadOnlySpan<char> i in programIds)+ foreach (string i in programIds){str.Append('"')- .Append(i.Slice(0, 10))+ .Append(i[..10]).Append("\",");}diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.csindex 678a27665b..50156d2b6f 100644--- a/Emby.Server.Implementations/Session/SessionManager.cs+++ b/Emby.Server.Implementations/Session/SessionManager.cs@@ -293,7 +293,7 @@ namespace Emby.Server.Implementations.Sessiontry{user.LastActivityDate = activityDate;- _userManager.UpdateUser(user);+ await _userManager.UpdateUserAsync(user);}catch (DbUpdateConcurrencyException e){diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.csindex b6b45e69b5..4d847ec959 100644--- a/Jellyfin.Server.Implementations/Users/UserManager.cs+++ b/Jellyfin.Server.Implementations/Users/UserManager.cs@@ -163,15 +163,6 @@ namespace Jellyfin.Server.Implementations.UsersOnUserUpdated?.Invoke(this, new GenericEventArgs<User>(user));}- /// <inheritdoc/>- public void UpdateUser(User user)- {- using var dbContext = _dbProvider.CreateContext();- dbContext.Users.Update(user);- _users[user.Id] = user;- dbContext.SaveChanges();- }-/// <inheritdoc/>public async Task UpdateUserAsync(User user){@@ -271,9 +262,9 @@ namespace Jellyfin.Server.Implementations.Users}/// <inheritdoc/>- public void ResetEasyPassword(User user)+ public Task ResetEasyPassword(User user){- ChangeEasyPassword(user, string.Empty, null);+ return ChangeEasyPassword(user, string.Empty, null);}/// <inheritdoc/>@@ -291,7 +282,7 @@ namespace Jellyfin.Server.Implementations.Users}/// <inheritdoc/>- public void ChangeEasyPassword(User user, string newPassword, string? newPasswordSha1)+ public async Task ChangeEasyPassword(User user, string newPassword, string? newPasswordSha1){if (newPassword != null){@@ -304,7 +295,7 @@ namespace Jellyfin.Server.Implementations.Users}user.EasyPassword = newPasswordSha1;- UpdateUser(user);+ await UpdateUserAsync(user);_eventManager.Publish(new UserPasswordChangedEventArgs(user));}diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.csindex 6e267834b0..41dfe1b967 100644--- a/MediaBrowser.Controller/Library/IUserManager.cs+++ b/MediaBrowser.Controller/Library/IUserManager.cs@@ -63,14 +63,6 @@ namespace MediaBrowser.Controller.Library/// <exception cref="ArgumentException"></exception>Task RenameUser(User user, string newName);- /// <summary>- /// Updates the user.- /// </summary>- /// <param name="user">The user.</param>- /// <exception cref="ArgumentNullException">user</exception>- /// <exception cref="ArgumentException"></exception>- void UpdateUser(User user);-/// <summary>/// Updates the user./// </summary>@@ -108,7 +100,7 @@ namespace MediaBrowser.Controller.Library/// </summary>/// <param name="user">The user.</param>/// <returns>Task.</returns>- void ResetEasyPassword(User user);+ Task ResetEasyPassword(User user);/// <summary>/// Changes the password.@@ -118,7 +110,7 @@ namespace MediaBrowser.Controller.Library/// <summary>/// Changes the easy password./// </summary>- void ChangeEasyPassword(User user, string newPassword, string newPasswordSha1);+ Task ChangeEasyPassword(User user, string newPassword, string newPasswordSha1);/// <summary>/// Gets the user dto.@@ -155,7 +147,7 @@ namespace MediaBrowser.Controller.Library/// <summary>/// This method updates the user's configuration./// This is only included as a stopgap until the new API, using this internally is not recommended.- /// Instead, modify the user object directly, then call <see cref="UpdateUser"/>.+ /// Instead, modify the user object directly, then call <see cref="UpdateUserAsync"/>./// </summary>/// <param name="userId">The user's Id.</param>/// <param name="config">The request containing the new user configuration.</param>@@ -165,7 +157,7 @@ namespace MediaBrowser.Controller.Library/// <summary>/// This method updates the user's policy./// This is only included as a stopgap until the new API, using this internally is not recommended.- /// Instead, modify the user object directly, then call <see cref="UpdateUser"/>.+ /// Instead, modify the user object directly, then call <see cref="UpdateUserAsync"/>./// </summary>/// <param name="userId">The user's Id.</param>/// <param name="policy">The request containing the new user policy.</param>