The Free Software Media System - Server Backend & API
Apply review suggestions
Shadowghoste3897fe5ddc6
diff --git a/Jellyfin.Api/Controllers/PlaylistsController.cs b/Jellyfin.Api/Controllers/PlaylistsController.csindex ca90d2a6d8..69abe5f7eb 100644--- a/Jellyfin.Api/Controllers/PlaylistsController.cs+++ b/Jellyfin.Api/Controllers/PlaylistsController.cs@@ -94,7 +94,7 @@ public class PlaylistsController : BaseJellyfinApiControllerUserId = userId.Value,MediaType = mediaType ?? createPlaylistRequest?.MediaType,Users = createPlaylistRequest?.Users.ToArray() ?? [],- Public = createPlaylistRequest?.Public+ Public = createPlaylistRequest?.IsPublic}).ConfigureAwait(false);return result;@@ -143,7 +143,7 @@ public class PlaylistsController : BaseJellyfinApiControllerName = updatePlaylistRequest.Name,Ids = updatePlaylistRequest.Ids,Users = updatePlaylistRequest.Users,- Public = updatePlaylistRequest.Public+ Public = updatePlaylistRequest.IsPublic}).ConfigureAwait(false);return NoContent();@@ -180,17 +180,19 @@ public class PlaylistsController : BaseJellyfinApiController}/// <summary>- /// Get a playlist users.+ /// Get a playlist user./// </summary>/// <param name="playlistId">The playlist id.</param>/// <param name="userId">The user id.</param>/// <response code="200">User permission found.</response>+ /// <response code="200">Access forbidden.</response>/// <response code="404">Playlist not found.</response>/// <returns>/// <see cref="PlaylistUserPermissions"/>./// </returns>[HttpGet("{playlistId}/Users/{userId}")][ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status403Forbidden)][ProducesResponseType(StatusCodes.Status404NotFound)]public ActionResult<PlaylistUserPermissions?> GetPlaylistUser([FromRoute, Required] Guid playlistId,@@ -209,7 +211,12 @@ public class PlaylistsController : BaseJellyfinApiController|| playlist.Shares.Any(s => s.CanEdit && s.UserId.Equals(callingUserId))|| userId.Equals(callingUserId);- if (isPermitted && userPermission is not null)+ if (!isPermitted)+ {+ return Forbid();+ }++ if (userPermission is not null){return userPermission;}@@ -218,7 +225,7 @@ public class PlaylistsController : BaseJellyfinApiController}/// <summary>- /// Modify a user to a playlist's users.+ /// Modify a user of a playlist's users./// </summary>/// <param name="playlistId">The playlist id.</param>/// <param name="userId">The user id.</param>@@ -237,7 +244,7 @@ public class PlaylistsController : BaseJellyfinApiControllerpublic async Task<ActionResult> UpdatePlaylistUser([FromRoute, Required] Guid playlistId,[FromRoute, Required] Guid userId,- [FromBody(EmptyBodyBehavior = EmptyBodyBehavior.Allow)] UpdatePlaylistUserDto updatePlaylistUserRequest)+ [FromBody(EmptyBodyBehavior = EmptyBodyBehavior.Allow), Required] UpdatePlaylistUserDto updatePlaylistUserRequest){var callingUserId = User.GetUserId();@@ -265,7 +272,7 @@ public class PlaylistsController : BaseJellyfinApiController}/// <summary>- /// Remove a user from a playlist's shares.+ /// Remove a user from a playlist's users./// </summary>/// <param name="playlistId">The playlist id.</param>/// <param name="userId">The user id.</param>diff --git a/Jellyfin.Api/Models/PlaylistDtos/CreatePlaylistDto.cs b/Jellyfin.Api/Models/PlaylistDtos/CreatePlaylistDto.csindex 69694a7699..3cbdd031a1 100644--- a/Jellyfin.Api/Models/PlaylistDtos/CreatePlaylistDto.cs+++ b/Jellyfin.Api/Models/PlaylistDtos/CreatePlaylistDto.cs@@ -41,5 +41,5 @@ public class CreatePlaylistDto/// <summary>/// Gets or sets a value indicating whether the playlist is public./// </summary>- public bool Public { get; set; } = true;+ public bool IsPublic { get; set; } = true;}diff --git a/Jellyfin.Api/Models/PlaylistDtos/UpdatePlaylistDto.cs b/Jellyfin.Api/Models/PlaylistDtos/UpdatePlaylistDto.csindex 0e109db3ee..80e20995c6 100644--- a/Jellyfin.Api/Models/PlaylistDtos/UpdatePlaylistDto.cs+++ b/Jellyfin.Api/Models/PlaylistDtos/UpdatePlaylistDto.cs@@ -30,5 +30,5 @@ public class UpdatePlaylistDto/// <summary>/// Gets or sets a value indicating whether the playlist is public./// </summary>- public bool? Public { get; set; }+ public bool? IsPublic { get; set; }}