Browse Source

Apply review suggestions

Shadowghost 1 year ago
parent
commit
51e2faa448
1 changed files with 7 additions and 6 deletions
  1. 7 6
      Jellyfin.Api/Controllers/PlaylistsController.cs

+ 7 - 6
Jellyfin.Api/Controllers/PlaylistsController.cs

@@ -113,7 +113,7 @@ public class PlaylistsController : BaseJellyfinApiController
     /// The task result contains an <see cref="OkResult"/> indicating success.
     /// The task result contains an <see cref="OkResult"/> indicating success.
     /// </returns>
     /// </returns>
     [HttpPost("{playlistId}")]
     [HttpPost("{playlistId}")]
-    [ProducesResponseType(StatusCodes.Status200OK)]
+    [ProducesResponseType(StatusCodes.Status204NoContent)]
     [ProducesResponseType(StatusCodes.Status403Forbidden)]
     [ProducesResponseType(StatusCodes.Status403Forbidden)]
     [ProducesResponseType(StatusCodes.Status404NotFound)]
     [ProducesResponseType(StatusCodes.Status404NotFound)]
     public async Task<ActionResult> UpdatePlaylist(
     public async Task<ActionResult> UpdatePlaylist(
@@ -185,16 +185,12 @@ public class PlaylistsController : BaseJellyfinApiController
     /// <param name="playlistId">The playlist id.</param>
     /// <param name="playlistId">The playlist id.</param>
     /// <param name="userId">The user id.</param>
     /// <param name="userId">The user id.</param>
     /// <response code="200">User permission found.</response>
     /// <response code="200">User permission found.</response>
-    /// <response code="200">No user permission found but open access.</response>
-    /// <response code="403">Access forbidden.</response>
     /// <response code="404">Playlist not found.</response>
     /// <response code="404">Playlist not found.</response>
     /// <returns>
     /// <returns>
     /// <see cref="PlaylistUserPermissions"/>.
     /// <see cref="PlaylistUserPermissions"/>.
     /// </returns>
     /// </returns>
     [HttpGet("{playlistId}/Users/{userId}")]
     [HttpGet("{playlistId}/Users/{userId}")]
     [ProducesResponseType(StatusCodes.Status200OK)]
     [ProducesResponseType(StatusCodes.Status200OK)]
-    [ProducesResponseType(StatusCodes.Status204NoContent)]
-    [ProducesResponseType(StatusCodes.Status403Forbidden)]
     [ProducesResponseType(StatusCodes.Status404NotFound)]
     [ProducesResponseType(StatusCodes.Status404NotFound)]
     public ActionResult<PlaylistUserPermissions?> GetPlaylistUser(
     public ActionResult<PlaylistUserPermissions?> GetPlaylistUser(
         [FromRoute, Required] Guid playlistId,
         [FromRoute, Required] Guid playlistId,
@@ -213,7 +209,12 @@ public class PlaylistsController : BaseJellyfinApiController
             || playlist.Shares.Any(s => s.CanEdit && s.UserId.Equals(callingUserId))
             || playlist.Shares.Any(s => s.CanEdit && s.UserId.Equals(callingUserId))
             || userId.Equals(callingUserId);
             || userId.Equals(callingUserId);
 
 
-        return isPermitted ? userPermission is not null ? userPermission : NotFound("User permissions not found") : playlist.OpenAccess ? NoContent() : Forbid();
+        if (isPermitted && userPermission is not null)
+        {
+            return userPermission;
+        }
+
+        return NotFound("User permissions not found");
     }
     }
 
 
     /// <summary>
     /// <summary>