Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBS-12170: always give country for artists in relations #3426

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ sub serialize
$body{'sort-name'} = $entity->sort_name;
$body{disambiguation} = $entity->comment // '';

$body{country} = $entity->area && $entity->area->country_code
? $entity->area->country_code : JSON::null;

if ($toplevel)
{
$body{gender} = $entity->gender ? $entity->gender_name : JSON::null;
$body{'gender-id'} = $entity->gender ? $entity->gender->gid : JSON::null;

$body{country} = $entity->area && $entity->area->country_code
? $entity->area->country_code : JSON::null;

$body{area} = $entity->area ? serialize_entity($entity->area) : JSON::null;
$body{'begin-area'} = $entity->begin_area ? serialize_entity($entity->begin_area) : JSON::null;
$body{'end-area'} = $entity->end_area ? serialize_entity($entity->end_area) : JSON::null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ test 'browse release group via release' => sub {
name => 'Distance',
'sort-name' => 'Distance',
disambiguation => 'UK dubstep artist Greg Sanders',
country => 'GB',
tags => [],
genres => [],
'type' => 'Person',
Expand Down Expand Up @@ -84,6 +85,7 @@ test 'browse release group via artist' => sub {
name => 'Distance',
'sort-name' => 'Distance',
disambiguation => 'UK dubstep artist Greg Sanders',
country => 'GB',
tags => [],
genres => [],
'type' => 'Person',
Expand Down Expand Up @@ -118,6 +120,7 @@ test 'browse release group via artist' => sub {
name => 'Distance',
'sort-name' => 'Distance',
disambiguation => 'UK dubstep artist Greg Sanders',
country => 'GB',
tags => [],
genres => [],
'type' => 'Person',
Expand Down Expand Up @@ -172,6 +175,7 @@ test 'browse official release groups via artist' => sub {
name => 'Distance',
'sort-name' => 'Distance',
disambiguation => 'UK dubstep artist Greg Sanders',
country => 'GB',
tags => [],
genres => [],
'type' => 'Person',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ test 'browse releases via recording, with recording rels' => sub {
'sort-name' => 'Blind Melon',
disambiguation => '',
name => 'Blind Melon',
country => 'US',
'type' => 'Group',
'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b',
},
Expand Down Expand Up @@ -383,6 +384,7 @@ test 'browse releases via recording, with recording rels' => sub {
'sort-name' => 'Allgood, Paul',
disambiguation => '',
name => 'Paul Allgood',
country => 'US',
'type' => 'Person',
'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ test 'artist lookup with recordings and artist credits' => sub {
name => 'm-flo',
'sort-name' => 'm-flo',
disambiguation => '',
country => 'JP',
type => 'Group',
'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b',
},
Expand All @@ -668,6 +669,7 @@ test 'artist lookup with recordings and artist credits' => sub {
name => 'BoA',
'sort-name' => 'BoA',
disambiguation => '',
country => 'KR',
'type' => 'Person',
'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df',
},
Expand All @@ -689,6 +691,7 @@ test 'artist lookup with recordings and artist credits' => sub {
name => 'm-flo',
'sort-name' => 'm-flo',
disambiguation => '',
country => 'JP',
type => 'Group',
'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b',
},
Expand All @@ -701,6 +704,7 @@ test 'artist lookup with recordings and artist credits' => sub {
name => 'BoA',
'sort-name' => 'BoA',
disambiguation => '',
country => 'KR',
'type' => 'Person',
'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df',
},
Expand Down Expand Up @@ -1154,6 +1158,7 @@ test 'artist lookup with artist relations' => sub {
name => '7人祭',
'sort-name' => '7nin Matsuri',
disambiguation => '',
country => 'JP',
type => 'Group',
'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ test 'recording lookup with releases, release-groups, and artists' => sub {
type => 'Group',
name => '7人祭',
disambiguation => '',
country => 'JP',
id => '802673f0-9b88-4e8a-bb5c-dd01d68b086f',
'sort-name' => '7nin Matsuri',
},
Expand Down Expand Up @@ -358,6 +359,7 @@ test 'recording lookup with artists' => sub {
name => 'm-flo',
'sort-name' => 'm-flo',
disambiguation => '',
country => 'JP',
'type' => 'Group',
'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b',
},
Expand All @@ -370,6 +372,7 @@ test 'recording lookup with artists' => sub {
name => 'BoA',
'sort-name' => 'BoA',
disambiguation => '',
country => 'KR',
'type' => 'Person',
'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df',
},
Expand Down Expand Up @@ -413,6 +416,7 @@ test 'recording lookup with release relationships' => sub {
name => 'Wedlock',
'sort-name' => 'Wedlock',
disambiguation => 'USA electro pop',
country => 'US',
'type' => 'Group',
'type-id' => 'e431f5f6-b5d2-343d-8b36-72607fffb74b',
},
Expand Down Expand Up @@ -443,6 +447,7 @@ test 'recording lookup with release relationships' => sub {
name => 'Paul Allgood',
'sort-name' => 'Allgood, Paul',
disambiguation => '',
country => 'US',
'type' => JSON::null,
'type-id' => JSON::null,
},
Expand Down Expand Up @@ -563,6 +568,7 @@ test 'recording lookup with work-level relationships' => sub {
disambiguation => 'UK dubstep artist Greg Sanders',
id => '472bc127-8861-45e8-bc9e-31e8dd32de7a',
name => 'Distance',
country => 'GB',
'sort-name' => 'Distance',
'type' => 'Person',
'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df',
Expand Down
Loading