fix(explore): gate playback on the same answer the row is drawn from
Two play paths still accepted `inLibrary`, so a row drawn dimmed and `aria-disabled` by the new rule would still attempt to play and fail with "this track could not be found in your library" — the disagreement this pass exists to remove, one layer down from the badge.
This commit is contained in:
@@ -2015,11 +2015,14 @@ export class ExploreArtistDetails extends LitElement implements ContextMenuHost
|
||||
|
||||
/**
|
||||
* File path for one top track, resolved by recording MBID — the
|
||||
* same key `inLibrary`/`localId` were set from. Works whether or
|
||||
* not the containing release itself matched a local album.
|
||||
* same key `localId` was set from. Works whether or not the
|
||||
* containing release itself matched a local album.
|
||||
*
|
||||
* Gated on the same answer the row is drawn from, or a row drawn
|
||||
* dimmed and `aria-disabled` would still try to play and fail.
|
||||
*/
|
||||
private async trackFilePath(track: LBTopRecording): Promise<string | null> {
|
||||
if (!(track.inLibrary || track.localId) || !track.recordingMbid) return null;
|
||||
if (!isOwned(track) || !track.recordingMbid) return null;
|
||||
|
||||
const libraryID = libraryStore.getSelectedLibraryId() ?? 0;
|
||||
const byMBID = await dictByName(
|
||||
|
||||
@@ -1241,8 +1241,11 @@ export class ExploreView extends ViewLifecycleMixin(LitElement) implements Conte
|
||||
void this.playAlbum(rg, false);
|
||||
}
|
||||
|
||||
private onRecordingRowDblClick(r: { mbid: string; inLibrary: boolean; localId?: number }): void {
|
||||
if (!r.inLibrary && !r.localId) return;
|
||||
// The same answer the row is drawn from. It used to accept
|
||||
// `inLibrary` as well, so a row drawn dimmed and `aria-disabled`
|
||||
// would still try to play and fail with a notification.
|
||||
private onRecordingRowDblClick(r: { mbid: string; localId?: number }): void {
|
||||
if (!isOwned(r)) return;
|
||||
|
||||
void this.playRecording(r.mbid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user