Convert UpdateUser to solely async

pull/6201/head
Patrick Barron 3 years ago
parent 8607b52541
commit 3ebc047434

@ -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("\",");
}

@ -293,7 +293,7 @@ namespace Emby.Server.Implementations.Session
try
{
user.LastActivityDate = activityDate;
_userManager.UpdateUser(user);
await _userManager.UpdateUserAsync(user);
}
catch (DbUpdateConcurrencyException e)
{

@ -163,15 +163,6 @@ namespace Jellyfin.Server.Implementations.Users
OnUserUpdated?.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));
}

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

Loading…
Cancel
Save