Skip to content

Commit

Permalink
Merge branch 'master' into beta
Browse files Browse the repository at this point in the history
* master:
  Fixes to #1874
  • Loading branch information
mwiencek committed Jun 20, 2021
2 parents 2d8ace6 + 01e54b7 commit 3f8057e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ around serialize => sub {

my $tags = $stash->store($entity)->{top_tags};
my @genres = map {
my $genre = $_->{tag}->genre;
$genre ? (DBDefs->CANONICAL_SERVER . '/genre/' . $genre->gid) : ()
my $genre = $_->{tag}{genre};
$genre ? (DBDefs->JSON_LD_ID_BASE_URI . '/genre/' . $genre->{gid}) : ()
} @$tags;

if (@genres) {
Expand Down
33 changes: 18 additions & 15 deletions t/lib/t/MusicBrainz/Server/Controller/Artist/Show.pm
Original file line number Diff line number Diff line change
Expand Up @@ -242,27 +242,27 @@ test 'Embedded JSON-LD `genre` property' => sub {
my $mech = $test->mech;
my $c = $test->c;

$c->sql->do(<<'EOSQL');
INSERT INTO artist (id, gid, name, sort_name)
VALUES (1, 'dcb48a49-b17d-49b9-aee5-4f168d8004d9', 'Group', 'Group');
INSERT INTO tag (id, name, ref_count)
VALUES (30, 'dubstep', 347), (31, 'debstup', 33);
$c->sql->do(<<~'EOSQL');
INSERT INTO artist (id, gid, name, sort_name)
VALUES (1, 'dcb48a49-b17d-49b9-aee5-4f168d8004d9', 'Group', 'Group');
INSERT INTO genre (id, gid, name)
VALUES (1, '1b50083b-1afa-4778-82c8-548b309af783', 'dubstep'),
(2, '2b50083b-1afa-4778-82c8-548b309af783', 'debstup');
INSERT INTO tag (id, name, ref_count)
VALUES (30, 'dubstep', 347), (31, 'debstup', 33);
INSERT INTO artist_tag (artist, count, last_updated, tag) VALUES (1, 3, '2011-01-18 15:21:33.71184+00', 30);
INSERT INTO genre (id, gid, name)
VALUES (1, '1b50083b-1afa-4778-82c8-548b309af783', 'dubstep'),
(2, '2b50083b-1afa-4778-82c8-548b309af783', 'debstup');
EOSQL
INSERT INTO artist_tag (artist, count, last_updated, tag)
VALUES (1, 3, '2011-01-18 15:21:33.71184+00', 30);
EOSQL

$mech->get_ok('/artist/dcb48a49-b17d-49b9-aee5-4f168d8004d9');
page_test_jsonld $mech => {
'name' => 'Group',
'@type' => 'MusicGroup',
'@id' => 'https://musicbrainz.org/artist/dcb48a49-b17d-49b9-aee5-4f168d8004d9',
'genre' => 'https://musicbrainz.org/genre/1b50083b-1afa-4778-82c8-548b309af783',
'@id' => 'http://musicbrainz.org/artist/dcb48a49-b17d-49b9-aee5-4f168d8004d9',
'genre' => 'http://musicbrainz.org/genre/1b50083b-1afa-4778-82c8-548b309af783',
'@context' => 'http://schema.org'
};

Expand All @@ -275,8 +275,11 @@ EOSQL
page_test_jsonld $mech => {
'name' => 'Group',
'@type' => 'MusicGroup',
'@id' => 'https://musicbrainz.org/artist/dcb48a49-b17d-49b9-aee5-4f168d8004d9',
'genre' => ['https://musicbrainz.org/genre/1b50083b-1afa-4778-82c8-548b309af783','https://musicbrainz.org/genre/2b50083b-1afa-4778-82c8-548b309af783'],
'@id' => 'http://musicbrainz.org/artist/dcb48a49-b17d-49b9-aee5-4f168d8004d9',
'genre' => [
'http://musicbrainz.org/genre/1b50083b-1afa-4778-82c8-548b309af783',
'http://musicbrainz.org/genre/2b50083b-1afa-4778-82c8-548b309af783',
],
'@context' => 'http://schema.org'
};
};
Expand Down

0 comments on commit 3f8057e

Please sign in to comment.