mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 04:34:18 +01:00
Merge pull request #9466 from Shadowghost/playlist-fix
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1819, CS1591
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public interface IHasShares
|
||||
{
|
||||
Share[] Shares { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public class Share
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
|
||||
public bool CanEdit { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -56,5 +56,20 @@ namespace MediaBrowser.Controller.Playlists
|
||||
/// <param name="newIndex">The new index.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task MoveItemAsync(string playlistId, string entryId, int newIndex);
|
||||
|
||||
/// <summary>
|
||||
/// Removed all playlists of a user.
|
||||
/// If the playlist is shared, ownership is transferred.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task RemovePlaylistsAsync(Guid userId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a playlist.
|
||||
/// </summary>
|
||||
/// <param name="playlist">The updated playlist.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task UpdatePlaylistAsync(Playlist playlist);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
namespace MediaBrowser.Controller.Playlists
|
||||
@@ -232,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;
|
||||
}
|
||||
@@ -240,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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user