Skip to content

Commit 23dd0a7

Browse files
authored
MBS-11846: Display release artist on release group view (metabrainz#2201)
Right now, there's no way to see if a release inside a release group has a different artist credit than the release group itself. This adds a release artist column to that view. It also adds an "artist-credit-variation" class for cases where the release and release group artist credits differ, to help userscript users highlight that (matching what we do for track artists on recording pages).
1 parent c108331 commit 23dd0a7

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

lib/MusicBrainz/Server/Controller/ReleaseGroup.pm

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ sub show : Chained('load') PathPart('') {
7878

7979
$c->model('Release')->load_related_info(@$releases);
8080
$c->model('Release')->load_meta(@$releases);
81+
$c->model('ArtistCredit')->load(@$releases);
8182
$c->model('ReleaseStatus')->load(@$releases);
8283
$c->model('CritiqueBrainz')->load_display_reviews($rg)
8384
unless $self->should_return_jsonld($c);

root/release_group/ReleaseGroupIndex.js

+22-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import CritiqueBrainzReview, {type CritiqueBrainzReviewT}
1818
import PaginatedResults from '../components/PaginatedResults';
1919
import TaggerIcon from '../static/scripts/common/components/TaggerIcon';
2020
import loopParity from '../utility/loopParity';
21+
import ArtistCreditLink
22+
from '../static/scripts/common/components/ArtistCreditLink';
2123
import EntityLink from '../static/scripts/common/components/EntityLink';
2224
import CleanupBanner from '../components/CleanupBanner';
2325
import FormRow from '../components/FormRow';
@@ -45,13 +47,17 @@ type Props = {
4547
+wikipediaExtract: WikipediaExtractT | null,
4648
};
4749

48-
function buildReleaseStatusTable($c, releaseStatusGroup) {
50+
function buildReleaseStatusTable(
51+
$c,
52+
releaseStatusGroup,
53+
releaseGroupCreditId,
54+
) {
4955
const status = releaseStatusGroup[0].status;
5056
return (
5157
<React.Fragment key={status ? status.name : 'no-status'}>
5258
<tr className="subh">
5359
{$c.user ? <th /> : null}
54-
<th colSpan={$c.session && $c.session.tport ? 8 : 7}>
60+
<th colSpan={$c.session && $c.session.tport ? 9 : 8}>
5561
{status?.name
5662
? lp_attributes(status.name, 'release_status')
5763
: lp('(unknown)', 'release status')}
@@ -72,6 +78,14 @@ function buildReleaseStatusTable($c, releaseStatusGroup) {
7278
<td>
7379
<EntityLink entity={release} showCaaPresence />
7480
</td>
81+
{/* The class being added is for usage with userscripts */}
82+
<td className={
83+
releaseGroupCreditId === release.artistCredit.id
84+
? null
85+
: 'artist-credit-variation'}
86+
>
87+
<ArtistCreditLink artistCredit={release.artistCredit} />
88+
</td>
7589
<td>{release.combined_format_name || l('[missing media]')}</td>
7690
<td>{release.combined_track_count || lp('-', 'missing data')}</td>
7791
<td>
@@ -139,6 +153,7 @@ const ReleaseGroupIndex = ({
139153
</th>
140154
) : null}
141155
<th>{l('Release')}</th>
156+
<th>{l('Artist')}</th>
142157
<th>{l('Format')}</th>
143158
<th>{l('Tracks')}</th>
144159
<th>{l('Country') + lp('/', 'and') + l('Date')}</th>
@@ -150,7 +165,11 @@ const ReleaseGroupIndex = ({
150165
</tr>
151166
</thead>
152167
<tbody>
153-
{releases.map(r => buildReleaseStatusTable($c, r))}
168+
{releases.map(releaseStatusGroup => buildReleaseStatusTable(
169+
$c,
170+
releaseStatusGroup,
171+
releaseGroup.artistCredit.id,
172+
))}
154173
</tbody>
155174
</table>
156175
</PaginatedResults>

0 commit comments

Comments
 (0)