Changeset a95dbfd in Klonkt


Ignore:
Timestamp:
06/30/2026 06:22:56 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
f24b795
Parents:
adb6291
Message:

fix(track-picker): allow inserting link-only tracks (Spotify/YouTube, no hosted file)

The "Insert track" picker disabled any track without a hosted media file (playable = !!filename), so
a link-only track (external Spotify/YouTube, 0:00) couldn't be inserted — even though [[track:]]
renders its link card fine on the post. Now a track is insertable if it has a file OR a link.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/admin-playlists.js

    radb6291 ra95dbfd  
    8888  const tracks = db.prepare(`
    8989    SELECT t.id, t.title, t.artist, t.duration, t.cover_url,
    90            m.filename
     90           t.link_spotify, t.link_youtube, t.link_soundcloud, m.filename
    9191    FROM audio_tracks t
    9292    LEFT JOIN media m ON m.id = t.media_id
     
    103103      duration: t.duration || 0,
    104104      cover: t.cover_url || '',
    105       playable: !!t.filename,
     105      // Insertable if it has a hosted file OR an external link — a link-only track ([[track:]])
     106      // still renders its Spotify/YouTube card on the post, so it must not be disabled in the picker.
     107      playable: !!t.filename || !!(t.link_spotify || t.link_youtube || t.link_soundcloud),
    106108    })),
    107109  });
Note: See TracChangeset for help on using the changeset viewer.