Skip to content

Rename playlists from the UI (double-click title + right-click → Edit playlist name) #59

Description

@isaaclins

Summary

Allow renaming a playlist directly from the UI. Today there's no way to edit a playlist's name — the only context-menu action available is "Pin to Sidebar".

Desired behavior

Two entry points, both should open an inline rename editor:

  1. Double-click the playlist title in the detail header (the large "May 26" title with "8 tracks" beneath it) → the title becomes an editable text field, like renaming a file/playlist in Finder/Apple Music. Commit on Enter, cancel on Esc.
  2. Right-click → "Edit playlist name" from the playlist's context menu (both in the sidebar list and the detail header). Currently this menu only offers "Pin to Sidebar".

On commit, persist the new name to Spotify and reflect it everywhere (sidebar row + detail header) optimistically.

Constraints

  • Spotify only permits renaming playlists the current user owns. The rename affordance (double-click + menu item) should only be shown when summary.ownerID == currentUserSpotifyID. Followed/other-user playlists should not show it.
  • Empty / whitespace-only names should be rejected (revert to the previous name).

Relevant code

  • Detail header (title + track count): Spotiglass/Views/PlaylistBrowser/PlaylistDetailContent.swiftheaderBlock (~L124-189); header context menu lives in LibraryHeaderPinningModifier (~L258-295), which already hosts the pin/unpin actions.
  • Sidebar context menu: Spotiglass/Views/PlaylistBrowser/PlaylistsSidebarSection.swiftplaylistSidebarRow .contextMenu (~L96-106), currently only Pin/Unpin.
  • API wrapper (needs new method): Spotiglass/Services/SpotifyAPIClient+Playlists.swift — no rename method exists. Add updatePlaylist(playlistID:name:) using PUT /v1/playlists/{id} with a JSON body { "name": ... }, following the sendVoidWrite() pattern in SpotifyAPIClient+Library.swift (~L41-71).
  • Browsing protocol: Spotiglass/Browsing/SpotifyBrowsingAPI.swift (~L35-42) — add the rename method to the contract.
  • Ownership check (already exists): PlaylistBrowserViewModel+TrackMutations.swift userOwnedPlaylistsForMenu (~L147-155) and currentUserSpotifyID in PlaylistBrowserViewModel.swift (~L27) — reuse the ownerID == currentUserSpotifyID gate.
  • Model: SpotifyPlaylistSummary in Spotiglass/Domain/SpotifyWebAPIDomain.swift (~L12-20) carries ownerID.

Acceptance criteria

  • Double-clicking the detail-header title of an owned playlist opens an inline editor; Enter saves, Esc cancels.
  • Right-clicking an owned playlist (sidebar and detail header) shows "Edit playlist name".
  • Rename persists via the Spotify API and updates the sidebar + header.
  • Affordances are hidden for playlists the user doesn't own.
  • Empty/whitespace names are rejected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiSpotify Web API integrationenhancementNew feature or requestuiVisible UI / layout

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions