Skip to content

Commit 0978f9d

Browse files
committed
MBS-14053: Add ended flag to aliases
This adds "ended" to aliases in XML to match what we already do in JSON. While ideally we would probably add a life-span element to aliases, that would be a big change given we already do dates as attributes, so it's probably better left for ws/3. For now, this matches what we do for the "primary" boolean.
1 parent 4c83f37 commit 0978f9d

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

lib/MusicBrainz/Server/WebService/XMLSerializer.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ sub _serialize_alias_list
115115
unless $al->begin_date->is_empty;
116116
$alias_node->_setAttribute('end-date', $al->end_date->format)
117117
unless $al->end_date->is_empty;
118+
$alias_node->_setAttribute('ended', 'ended') if $al->ended;
118119

119120
$alias_node->appendText($al->name);
120121
}

t/lib/t/MusicBrainz/Server/Controller/WS/2/BrowseArtists.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ ws2_test_xml 'browse artists via recording',
4444
<begin>1986-11-05</begin>
4545
</life-span>
4646
<alias-list count="5">
47-
<alias sort-name="Beat of Angel" begin-date="1001-01-10" end-date="2002-02-20">Beat of Angel</alias>
48-
<alias sort-name="BoA Kwon">BoA Kwon</alias>
47+
<alias sort-name="Beat of Angel" begin-date="1001-01-10" end-date="2002-02-20" ended="ended">Beat of Angel</alias>
48+
<alias sort-name="BoA Kwon" ended="ended">BoA Kwon</alias>
4949
<alias sort-name="Kwon BoA">Kwon BoA</alias>
5050
<alias sort-name="ボア" type="Artist name" type-id="894afba6-2816-3c24-8072-eadb66bd04bc">ボア</alias>
5151
<alias locale="ko" sort-name="보아" primary="primary">보아</alias>

t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseArtists.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ test 'browse artists via recording' => sub {
102102
'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df',
103103
aliases => [
104104
{ name => 'Beat of Angel', 'sort-name' => 'Beat of Angel', locale => JSON::null, primary => JSON::null, type => JSON::null, 'type-id' => JSON::null, , begin => '1001-01-10', end => '2002-02-20', ended => JSON::true },
105-
{ name => 'BoA Kwon', 'sort-name' => 'BoA Kwon', locale => JSON::null, primary => JSON::null, type => JSON::null, 'type-id' => JSON::null, begin => JSON::null, end => JSON::null, ended => JSON::false },
105+
{ name => 'BoA Kwon', 'sort-name' => 'BoA Kwon', locale => JSON::null, primary => JSON::null, type => JSON::null, 'type-id' => JSON::null, begin => JSON::null, end => JSON::null, ended => JSON::true },
106106
{ name => 'Kwon BoA', 'sort-name' => 'Kwon BoA', locale => JSON::null, primary => JSON::null, type => JSON::null, 'type-id' => JSON::null, begin => JSON::null, end => JSON::null, ended => JSON::false },
107107
{ name => 'ボア', 'sort-name' => 'ボア', locale => JSON::null, primary => JSON::null, type => 'Artist name', 'type-id' => '894afba6-2816-3c24-8072-eadb66bd04bc', begin => JSON::null, end => JSON::null, ended => JSON::false },
108108
{ name => '보아', 'sort-name' => '보아', locale => 'ko', primary => JSON::true, type => JSON::null, 'type-id' => JSON::null, begin => JSON::null, end => JSON::null, ended => JSON::false },

t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ test 'basic artist lookup, inc=aliases' => sub {
123123
'type-id' => 'b6e035f4-3ce9-331c-97df-83397230b0df',
124124
aliases => [
125125
{ name => 'Beat of Angel', 'sort-name' => 'Beat of Angel', locale => JSON::null, primary => JSON::null, type => JSON::null, 'type-id' => JSON::null, begin => '1001-01-10', end => '2002-02-20', ended => JSON::true },
126-
{ name => 'BoA Kwon', 'sort-name' => 'BoA Kwon', locale => JSON::null, primary => JSON::null, type => JSON::null, 'type-id' => JSON::null, begin => JSON::null, end => JSON::null, ended => JSON::false },
126+
{ name => 'BoA Kwon', 'sort-name' => 'BoA Kwon', locale => JSON::null, primary => JSON::null, type => JSON::null, 'type-id' => JSON::null, begin => JSON::null, end => JSON::null, ended => JSON::true },
127127
{ name => 'Kwon BoA', 'sort-name' => 'Kwon BoA', locale => JSON::null, primary => JSON::null, type => JSON::null, 'type-id' => JSON::null, begin => JSON::null, end => JSON::null, ended => JSON::false },
128128
{ name => 'ボア', 'sort-name' => 'ボア', locale => JSON::null, primary => JSON::null, type => 'Artist name', 'type-id' => '894afba6-2816-3c24-8072-eadb66bd04bc', begin => JSON::null, end => JSON::null, ended => JSON::false },
129129
{ name => '보아', 'sort-name' => '보아', locale => 'ko', primary => JSON::true, type => JSON::null, 'type-id' => JSON::null, begin => JSON::null, end => JSON::null, ended => JSON::false },

t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupArtist.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ ws_test 'artist lookup, inc=aliases',
5959
<begin>1986-11-05</begin>
6060
</life-span>
6161
<alias-list count="5">
62-
<alias sort-name="Beat of Angel" begin-date="1001-01-10" end-date="2002-02-20">Beat of Angel</alias>
63-
<alias sort-name="BoA Kwon">BoA Kwon</alias>
62+
<alias sort-name="Beat of Angel" begin-date="1001-01-10" end-date="2002-02-20" ended="ended">Beat of Angel</alias>
63+
<alias sort-name="BoA Kwon" ended="ended">BoA Kwon</alias>
6464
<alias sort-name="Kwon BoA">Kwon BoA</alias>
6565
<alias sort-name="ボア" type="Artist name" type-id="894afba6-2816-3c24-8072-eadb66bd04bc">ボア</alias>
6666
<alias locale="ko" sort-name="보아" primary="primary">보아</alias>

t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupRelease.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,8 +1432,8 @@ ws_test 'release lookup, track artists have no aliases',
14321432
<artist id="a16d1433-ba89-4f72-a47b-a370add0bb55" type="Person" type-id="b6e035f4-3ce9-331c-97df-83397230b0df">
14331433
<name>BoA</name><sort-name>BoA</sort-name>
14341434
<alias-list count="5">
1435-
<alias sort-name="Beat of Angel" begin-date="1001-01-10" end-date="2002-02-20">Beat of Angel</alias>
1436-
<alias sort-name="BoA Kwon">BoA Kwon</alias>
1435+
<alias sort-name="Beat of Angel" begin-date="1001-01-10" end-date="2002-02-20" ended="ended">Beat of Angel</alias>
1436+
<alias sort-name="BoA Kwon" ended="ended">BoA Kwon</alias>
14371437
<alias sort-name="Kwon BoA">Kwon BoA</alias>
14381438
<alias sort-name="ボア" type="Artist name" type-id="894afba6-2816-3c24-8072-eadb66bd04bc">ボア</alias>
14391439
<alias locale="ko" sort-name="보아" primary="primary">보아</alias>
@@ -1487,8 +1487,8 @@ ws_test 'release lookup, track artists have no aliases',
14871487
<artist id="a16d1433-ba89-4f72-a47b-a370add0bb55" type="Person" type-id="b6e035f4-3ce9-331c-97df-83397230b0df">
14881488
<name>BoA</name><sort-name>BoA</sort-name>
14891489
<alias-list count="5">
1490-
<alias sort-name="Beat of Angel" begin-date="1001-01-10" end-date="2002-02-20">Beat of Angel</alias>
1491-
<alias sort-name="BoA Kwon">BoA Kwon</alias>
1490+
<alias sort-name="Beat of Angel" begin-date="1001-01-10" end-date="2002-02-20" ended="ended">Beat of Angel</alias>
1491+
<alias sort-name="BoA Kwon" ended="ended">BoA Kwon</alias>
14921492
<alias sort-name="Kwon BoA">Kwon BoA</alias>
14931493
<alias sort-name="ボア" type="Artist name" type-id="894afba6-2816-3c24-8072-eadb66bd04bc">ボア</alias>
14941494
<alias locale="ko" sort-name="보아" primary="primary">보아</alias>

t/sql/webservice.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ INSERT INTO artist_alias (artist, begin_date_day, begin_date_month, begin_date_y
106106
INSERT INTO artist_alias (artist, begin_date_day, begin_date_month, begin_date_year, edits_pending, end_date_day, end_date_month, end_date_year, id, last_updated, locale, name, primary_for_locale, sort_name, type) VALUES (135345, NULL, NULL, NULL, 0, NULL, NULL, NULL, 69815, '2011-01-18 15:20:17.74049+00', NULL, 'エムフロウ', '0', 'エムフロウ', NULL);
107107
INSERT INTO artist_alias (artist, begin_date_day, begin_date_month, begin_date_year, edits_pending, end_date_day, end_date_month, end_date_year, id, last_updated, locale, name, primary_for_locale, sort_name, type) VALUES (9496, 10, 01, 1001, 0, 20, 02, 2002, 11905, '2011-01-18 15:20:17.74049+00', NULL, 'Beat of Angel', '0', 'Beat of Angel', NULL);
108108
INSERT INTO artist_alias (artist, begin_date_day, begin_date_month, begin_date_year, edits_pending, end_date_day, end_date_month, end_date_year, id, last_updated, locale, name, primary_for_locale, sort_name, type) VALUES (9496, NULL, NULL, NULL, 0, NULL, NULL, NULL, 70378, '2011-01-18 15:20:17.74049+00', NULL, 'ボア', '0', 'ボア', 1);
109-
INSERT INTO artist_alias (artist, begin_date_day, begin_date_month, begin_date_year, edits_pending, end_date_day, end_date_month, end_date_year, id, last_updated, locale, name, primary_for_locale, sort_name, type) VALUES (9496, NULL, NULL, NULL, 0, NULL, NULL, NULL, 11902, '2011-01-18 15:20:17.74049+00', NULL, 'BoA Kwon', '0', 'BoA Kwon', NULL);
109+
INSERT INTO artist_alias (artist, begin_date_day, begin_date_month, begin_date_year, edits_pending, end_date_day, end_date_month, end_date_year, id, last_updated, locale, name, primary_for_locale, sort_name, type, ended) VALUES (9496, NULL, NULL, NULL, 0, NULL, NULL, NULL, 11902, '2011-01-18 15:20:17.74049+00', NULL, 'BoA Kwon', '0', 'BoA Kwon', NULL, '1');
110110
INSERT INTO artist_alias (artist, begin_date_day, begin_date_month, begin_date_year, edits_pending, end_date_day, end_date_month, end_date_year, id, last_updated, locale, name, primary_for_locale, sort_name, type) VALUES (9496, NULL, NULL, NULL, 0, NULL, NULL, NULL, 11901, '2011-01-18 15:20:17.74049+00', NULL, 'Kwon BoA', '0', 'Kwon BoA', NULL);
111111
INSERT INTO artist_alias (artist, begin_date_day, begin_date_month, begin_date_year, edits_pending, end_date_day, end_date_month, end_date_year, id, last_updated, locale, name, primary_for_locale, sort_name, type) VALUES (9496, NULL, NULL, NULL, 0, NULL, NULL, NULL, 18652, '2011-01-18 15:20:17.74049+00', 'ko', '보아', '1', '보아', NULL);
112112
INSERT INTO artist_alias (artist, begin_date_day, begin_date_month, begin_date_year, edits_pending, end_date_day, end_date_month, end_date_year, id, last_updated, locale, name, primary_for_locale, sort_name, type) VALUES (242, NULL, NULL, NULL, 0, NULL, NULL, NULL, 34446, '2011-01-18 15:20:17.74049+00', NULL, 'Chemical Brother', '0', 'Chemical Brother', NULL);

0 commit comments

Comments
 (0)