MBS-13416: Link to entity pages from LB buttons #3418
+32
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement MBS-13416
Problem
We now have entity pages for artists and RGs ("albums") in ListenBrainz, but we still link only to BrainzPlayer playlists.
Solution
This changes the LB buttons to link to entity pages when possible.
Release links redirect to release groups, so the LB team advised to just link to RGs directly. Since the pages cannot be played if empty, we don't change the existing behaviour where we hide the buttons if no releases exist in an RG
or no tracks exist on a release. We no longer care about the first release's MBID for RGs, just that it exists, so this simplifies that parameter to be boolean.
Also adding links for artists since those are now available. I did not skip "empty" artists (with no releases nor recordings) because we only have this data from the artist index but we want the buttons to appear on all tabs, and it doesn't seem worth passing a boolean up from the Perl layer just for this.
Recording pages do not yet exist, so we keep linking to the player for recordings (and recording collections). Since recordings are the only case where an array of MBIDs is actually supported, I changed the code to just return nothing when passed an array in any other case.
Testing
Manually, with sample data, particularly
/artist/ae0b2424-d4c5-4c54-82ac-fe3be5453270
and/release-group/863ca853-cc83-47dd-8106-1284399c44f5