mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-26 12:05:04 +01:00
Apply review suggestions
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -11,7 +9,6 @@ using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.LocalMetadata.Savers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
@@ -20,11 +17,11 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
/// </summary>
|
||||
public class PlaylistResolver : GenericFolderResolver<Playlist>
|
||||
{
|
||||
private CollectionType?[] _musicPlaylistCollectionTypes =
|
||||
{
|
||||
private readonly CollectionType?[] _musicPlaylistCollectionTypes =
|
||||
[
|
||||
null,
|
||||
CollectionType.music
|
||||
};
|
||||
];
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override Playlist Resolve(ItemResolveArgs args)
|
||||
|
||||
@@ -134,8 +134,8 @@ namespace Emby.Server.Implementations.Playlists
|
||||
Name = name,
|
||||
Path = path,
|
||||
OwnerUserId = options.UserId,
|
||||
Shares = options.Shares ?? [],
|
||||
OpenAccess = options.OpenAccess ?? false
|
||||
Shares = options.Users ?? [],
|
||||
OpenAccess = options.Public ?? false
|
||||
};
|
||||
|
||||
playlist.SetMediaType(options.MediaType);
|
||||
@@ -171,9 +171,9 @@ namespace Emby.Server.Implementations.Playlists
|
||||
return path;
|
||||
}
|
||||
|
||||
private List<BaseItem> GetPlaylistItems(IEnumerable<Guid> itemIds, MediaType playlistMediaType, User user, DtoOptions options)
|
||||
private IReadOnlyList<BaseItem> GetPlaylistItems(IEnumerable<Guid> itemIds, MediaType playlistMediaType, User user, DtoOptions options)
|
||||
{
|
||||
var items = itemIds.Select(i => _libraryManager.GetItemById(i)).Where(i => i is not null);
|
||||
var items = itemIds.Select(_libraryManager.GetItemById).Where(i => i is not null);
|
||||
|
||||
return Playlist.GetPlaylistItems(playlistMediaType, items, user, options);
|
||||
}
|
||||
@@ -556,11 +556,11 @@ namespace Emby.Server.Implementations.Playlists
|
||||
await UpdatePlaylist(playlist).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task AddToShares(Guid playlistId, Guid userId, Share share)
|
||||
public async Task AddToShares(Guid playlistId, Guid userId, UserPermissions share)
|
||||
{
|
||||
var playlist = GetPlaylist(userId, playlistId);
|
||||
var shares = playlist.Shares.ToList();
|
||||
var existingUserShare = shares.FirstOrDefault(s => s.UserId?.Equals(share.UserId, StringComparison.OrdinalIgnoreCase) ?? false);
|
||||
var existingUserShare = shares.FirstOrDefault(s => s.UserId.Equals(share.UserId, StringComparison.OrdinalIgnoreCase));
|
||||
if (existingUserShare is not null)
|
||||
{
|
||||
shares.Remove(existingUserShare);
|
||||
@@ -571,7 +571,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
await UpdatePlaylist(playlist).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task RemoveFromShares(Guid playlistId, Guid userId, Share share)
|
||||
public async Task RemoveFromShares(Guid playlistId, Guid userId, UserPermissions share)
|
||||
{
|
||||
var playlist = GetPlaylist(userId, playlistId);
|
||||
var shares = playlist.Shares.ToList();
|
||||
|
||||
Reference in New Issue
Block a user