Apply review suggestions

This commit is contained in:
Shadowghost 2023-03-12 19:42:18 +01:00 committed by Shadowghost
parent 8d158df678
commit 82080bd1ef
5 changed files with 10 additions and 10 deletions

View File

@ -530,7 +530,7 @@ namespace Emby.Server.Implementations.Playlists
_libraryManager.GetUserRootFolder().Children.OfType<Folder>().FirstOrDefault(i => string.Equals(i.GetType().Name, TypeName, StringComparison.Ordinal));
}
public async Task RemovePlaylists(Guid userId)
public async Task RemovePlaylistsAsync(Guid userId)
{
var playlists = GetPlaylists(userId);
foreach (var playlist in playlists)
@ -564,7 +564,7 @@ namespace Emby.Server.Implementations.Playlists
}
}
public async Task UpdatePlaylist(Playlist playlist)
public async Task UpdatePlaylistAsync(Playlist playlist)
{
var currentPlaylist = (Playlist)_libraryManager.GetItemById(playlist.Id);
currentPlaylist.OwnerUserId = playlist.OwnerUserId;
@ -572,7 +572,7 @@ namespace Emby.Server.Implementations.Playlists
await playlist.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
if (playlist.IsFile)
if (currentPlaylist.IsFile)
{
SavePlaylistFile(currentPlaylist);
}

View File

@ -158,7 +158,7 @@ public class UserController : BaseJellyfinApiController
}
await _sessionManager.RevokeUserTokens(user.Id, null).ConfigureAwait(false);
await _playlistManager.RemovePlaylists(userId).ConfigureAwait(false);
await _playlistManager.RemovePlaylistsAsync(userId).ConfigureAwait(false);
await _userManager.DeleteUserAsync(userId).ConfigureAwait(false);
return NoContent();
}

View File

@ -59,7 +59,7 @@ internal class FixPlaylistOwner : IMigrationRoutine
playlist.OwnerUserId = guid;
playlist.Shares = shares.Where(x => x != firstEditShare).ToArray();
_playlistManager.UpdatePlaylist(playlist).GetAwaiter().GetResult();
_playlistManager.UpdatePlaylistAsync(playlist).GetAwaiter().GetResult();
}
}
}

View File

@ -63,13 +63,13 @@ namespace MediaBrowser.Controller.Playlists
/// </summary>
/// <param name="userId">The user id.</param>
/// <returns>Task.</returns>
Task RemovePlaylists(Guid userId);
Task RemovePlaylistsAsync(Guid userId);
/// <summary>
/// Updates a playlist.
/// </summary>
/// <param name="playlist">The updated playlist.</param>
/// <returns>Task.</returns>
Task UpdatePlaylist(Playlist playlist);
Task UpdatePlaylistAsync(Playlist playlist);
}
}

View File

@ -233,7 +233,8 @@ namespace MediaBrowser.Controller.Playlists
return base.IsVisible(user);
}
if (user.Id.Equals(OwnerUserId))
var userId = user.Id;
if (userId.Equals(OwnerUserId))
{
return true;
}
@ -241,10 +242,9 @@ namespace MediaBrowser.Controller.Playlists
var shares = Shares;
if (shares.Length == 0)
{
return base.IsVisible(user);
return false;
}
var userId = user.Id;
return shares.Any(share => Guid.TryParse(share.UserId, out var id) && id.Equals(userId));
}