mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 22:17:25 -04:00
Convert UpdateUser to solely async
This commit is contained in:
parent
8607b52541
commit
3ebc047434
4 changed files with 11 additions and 28 deletions
|
@ -457,10 +457,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder str = new StringBuilder("[", 1 + (programIds.Count * 13));
|
StringBuilder str = new StringBuilder("[", 1 + (programIds.Count * 13));
|
||||||
foreach (ReadOnlySpan<char> i in programIds)
|
foreach (string i in programIds)
|
||||||
{
|
{
|
||||||
str.Append('"')
|
str.Append('"')
|
||||||
.Append(i.Slice(0, 10))
|
.Append(i[..10])
|
||||||
.Append("\",");
|
.Append("\",");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
user.LastActivityDate = activityDate;
|
user.LastActivityDate = activityDate;
|
||||||
_userManager.UpdateUser(user);
|
await _userManager.UpdateUserAsync(user);
|
||||||
}
|
}
|
||||||
catch (DbUpdateConcurrencyException e)
|
catch (DbUpdateConcurrencyException e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -163,15 +163,6 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
OnUserUpdated?.Invoke(this, new GenericEventArgs<User>(user));
|
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/>
|
/// <inheritdoc/>
|
||||||
public async Task UpdateUserAsync(User user)
|
public async Task UpdateUserAsync(User user)
|
||||||
{
|
{
|
||||||
|
@ -271,9 +262,9 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void ResetEasyPassword(User user)
|
public Task ResetEasyPassword(User user)
|
||||||
{
|
{
|
||||||
ChangeEasyPassword(user, string.Empty, null);
|
return ChangeEasyPassword(user, string.Empty, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
@ -291,7 +282,7 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void ChangeEasyPassword(User user, string newPassword, string? newPasswordSha1)
|
public async Task ChangeEasyPassword(User user, string newPassword, string? newPasswordSha1)
|
||||||
{
|
{
|
||||||
if (newPassword != null)
|
if (newPassword != null)
|
||||||
{
|
{
|
||||||
|
@ -304,7 +295,7 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
}
|
}
|
||||||
|
|
||||||
user.EasyPassword = newPasswordSha1;
|
user.EasyPassword = newPasswordSha1;
|
||||||
UpdateUser(user);
|
await UpdateUserAsync(user);
|
||||||
|
|
||||||
_eventManager.Publish(new UserPasswordChangedEventArgs(user));
|
_eventManager.Publish(new UserPasswordChangedEventArgs(user));
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,14 +63,6 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <exception cref="ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
Task RenameUser(User user, string newName);
|
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>
|
/// <summary>
|
||||||
/// Updates the user.
|
/// Updates the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -108,7 +100,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
void ResetEasyPassword(User user);
|
Task ResetEasyPassword(User user);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Changes the password.
|
/// Changes the password.
|
||||||
|
@ -118,7 +110,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Changes the easy password.
|
/// Changes the easy password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void ChangeEasyPassword(User user, string newPassword, string newPasswordSha1);
|
Task ChangeEasyPassword(User user, string newPassword, string newPasswordSha1);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user dto.
|
/// Gets the user dto.
|
||||||
|
@ -155,7 +147,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method updates the user's configuration.
|
/// This method updates the user's configuration.
|
||||||
/// This is only included as a stopgap until the new API, using this internally is not recommended.
|
/// 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>
|
/// </summary>
|
||||||
/// <param name="userId">The user's Id.</param>
|
/// <param name="userId">The user's Id.</param>
|
||||||
/// <param name="config">The request containing the new user configuration.</param>
|
/// <param name="config">The request containing the new user configuration.</param>
|
||||||
|
@ -165,7 +157,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method updates the user's policy.
|
/// This method updates the user's policy.
|
||||||
/// This is only included as a stopgap until the new API, using this internally is not recommended.
|
/// 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>
|
/// </summary>
|
||||||
/// <param name="userId">The user's Id.</param>
|
/// <param name="userId">The user's Id.</param>
|
||||||
/// <param name="policy">The request containing the new user policy.</param>
|
/// <param name="policy">The request containing the new user policy.</param>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue