v3: added an "in collections" section to dump pages, listing the collections a dump belongs to
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -382,6 +382,26 @@ export function getPlaylistMembershipsForDump(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The playlists a dump appears in — the "in collections" counterpart to
|
||||
* backlinks. Privacy-filtered like `getRelatedDumps`: public playlists for
|
||||
* everyone, plus the requesting user's own private ones. Capped at 20 — a
|
||||
* small, bounded list of supporting context.
|
||||
*/
|
||||
export function getPlaylistsForDump(
|
||||
dumpId: string,
|
||||
requestingUserId?: string,
|
||||
): Playlist[] {
|
||||
const rows = db.prepare(
|
||||
`SELECT ${PLAYLIST_SELECT}
|
||||
INNER JOIN playlist_dumps pd ON pd.playlist_id = p.id
|
||||
WHERE pd.dump_id = ? AND (p.is_public = 1 OR p.user_id = ?)
|
||||
ORDER BY p.created_at DESC LIMIT 20;`,
|
||||
).all(dumpId, requestingUserId ?? "");
|
||||
|
||||
return rows.filter(isPlaylistRow).map(playlistRowToApi);
|
||||
}
|
||||
|
||||
export function getPlaylistImageInfo(
|
||||
idOrSlug: string,
|
||||
): { id: string; imageMime: string } | undefined {
|
||||
|
||||
Reference in New Issue
Block a user