Skip to content

Commit 26e0d57

Browse files
committed
Merge branch 'beta' into production
* beta: Update POT files using the production database Update translations from Transifex MBS-11583: Use sanitized context in hydrated component (metabrainz#2066) MBS-11569: Limit entity types when creating collection from sidebar (metabrainz#2048) Update POT files using the production database Update translations from Transifex MBS-9631: Add 1200px to available image sizes (metabrainz#2054) Remove unused $c variable MBS-11582: Add a sortname method for instrument guess case (metabrainz#2065) Fix Catalyst warning: don't try undef linktype id to access $loaded (metabrainz#2062) MBS-11527: Block smart links: music.indiefy.net (metabrainz#2016) MBS-11533: Block smart links: snd.click (metabrainz#2023) Add keys to EditReleaseEvents to stop warning (metabrainz#2063) Fix Catalyst warning: don't try using undef to access hash (metabrainz#2059) Fix Catalyst warning: ensure parent format id is not undef (metabrainz#2060) MBS-11564: Don't block Niconi Commons links with Nicovideo cleanup (metabrainz#2044) MBS-11500: Do not pass GID of removed release to avoid linking (metabrainz#2035) MBS-11563: Invalidate entity_link_type_counts on relationship inserts (metabrainz#2047) Fix Catalyst warning: don't pass undef review text to markdown (metabrainz#2061) Fix Catalyst warning: id is missing in edit previews (metabrainz#2057) MBS-10534: Handle DNB links (metabrainz#2030) MBS-11581: Skip darkened releases on Artwork->load_for_release_groups MBS-11581: Don't load darkened cover art for Set Cover Art form MBS-11552: Add validation for Classical Archives links MBS-11542: Allow and cleanup new Classical Archives links MBS-11524: Disallow https://*.bandcamp.com/ URLs at release and recording level (metabrainz#2050) MBS-11566: Ensure consistent ordering of appearances sections Bump Flow to 0.148.0 Optimize help message and fix CI MBS-9833: Add relationship style guide link MBS-11516: Use React.useContext in [Entity]List MBS-11514: Use React.useContext in [Entity]Sidebar MBS-11514: Use React.useContext in SidebarTags MBS-11514: Use React.useContext in SubscriptionLinks MBS-11517: Use React.useContext in MergeHelper MBS-11515: Use React.useContext in Footer MBS-11515: Use React.useContext in TopMenu/BottomMenu MBS-11515: Use React.useContext in Head MBS-11514: Use React.useContext in CollectionLinks MBS-11514: Use React.useContext in AnnotationLinks MBS-11514: Use React.useContext in EditLinks
2 parents 7a49429 + 654dc8c commit 26e0d57

File tree

194 files changed

+6992
-5960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+6992
-5960
lines changed

lib/MusicBrainz/Server/Controller/Collection.pm

+11-6
Original file line numberDiff line numberDiff line change
@@ -240,21 +240,26 @@ sub create : Local RequireAuth {
240240

241241
my $form;
242242
if ($initial_entity_type) {
243-
$form = $c->form( form => 'Collection', init_object => { type_id => $initial_entity_type->id } );
243+
$form = $c->form( form => 'Collection', init_object => { allowed_entity_type => $initial_entity_type->item_entity_type, type_id => $initial_entity_type->id } );
244244
} else {
245245
$form = $c->form( form => 'Collection' );
246246
}
247247

248248
if ($c->form_posted_and_valid($form)) {
249249
my %insert = $self->_form_to_hash($form);
250-
my $collection = $c->model('Collection')->insert($c->user->id, \%insert);
250+
my $collection_ids = $c->model('Collection')->insert($c->user->id, \%insert);
251251
if ($initial_entity_id) {
252-
$c->model('Collection')->add_entities_to_collection(
253-
$initial_entity_type->item_entity_type, $collection->{id}, $initial_entity_id
254-
);
252+
my $collection = $c->model('Collection')->get_by_gid($collection_ids->{gid});
253+
$c->model('CollectionType')->load($collection);
254+
# Avoid adding the entity if the collection entity type has changed somehow (MBS-11569)
255+
if ($initial_entity_type->item_entity_type eq $collection->type->item_entity_type) {
256+
$c->model('Collection')->add_entities_to_collection(
257+
$initial_entity_type->item_entity_type, $collection->{id}, $initial_entity_id
258+
);
259+
}
255260
}
256261

257-
$self->_redirect_to_collection($c, $collection->{gid});
262+
$self->_redirect_to_collection($c, $collection_ids->{gid});
258263
}
259264

260265
my %props = (

lib/MusicBrainz/Server/Controller/ReleaseGroup.pm

+3-1
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,11 @@ sub set_cover_art : Chained('load') PathPart('set-cover-art') Args(0) Edit
169169
my ($releases, $hits) = $c->model('Release')->find_by_release_group(
170170
$entity->id);
171171
$c->model('Release')->load_related_info(@$releases);
172+
$c->model('Release')->load_meta(@$releases);
172173
$c->model('ArtistCredit')->load(@$releases);
173174

174-
my $artwork = $c->model('Artwork')->find_front_cover_by_release(@$releases);
175+
my @non_darkened_releases = grep { $_->may_have_cover_art } @$releases;
176+
my $artwork = $c->model('Artwork')->find_front_cover_by_release(@non_darkened_releases);
175177
$c->model('CoverArtType')->load_for(@$artwork);
176178
my %artwork_map = map { $_->release->id => $_ } @$artwork;
177179

lib/MusicBrainz/Server/Data/Artwork.pm

+3
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ sub load_for_release_groups
181181
FROM cover_art_archive.index_listing
182182
JOIN musicbrainz.release
183183
ON musicbrainz.release.id = cover_art_archive.index_listing.release
184+
JOIN musicbrainz.release_meta
185+
ON musicbrainz.release_meta.id = musicbrainz.release.id
184186
LEFT JOIN (
185187
SELECT release, date_year, date_month, date_day
186188
FROM release_country
@@ -194,6 +196,7 @@ sub load_for_release_groups
194196
ON cover_art_archive.index_listing.mime_type = cover_art_archive.image_type.mime_type
195197
WHERE release.release_group IN (" . placeholders(@ids) . ")
196198
AND is_front = true
199+
AND cover_art_presence != 'darkened'
197200
ORDER BY release.release_group, release_group_cover_art.release,
198201
release_event.date_year, release_event.date_month,
199202
release_event.date_day";

lib/MusicBrainz/Server/Data/CritiqueBrainz.pm

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use JSON;
77
use Text::Markdown qw( markdown );
88
use Text::Trim qw( trim );
99
use URI;
10+
use MusicBrainz::Server::Data::Utils qw( non_empty );
1011
use MusicBrainz::Server::Translation qw( l );
1112
use MusicBrainz::Server::Validation qw( encode_entities );
1213
use aliased 'MusicBrainz::Server::Entity::CritiqueBrainz::Review';
@@ -63,7 +64,7 @@ sub _parse_review {
6364
return Review->new(
6465
id => $data->{id},
6566
created => DateTime->from_epoch(epoch => str2time($data->{created})),
66-
body => markdown($data->{text}),
67+
body => non_empty($data->{text}) ? markdown($data->{text}) : '',
6768
author => User->new(id => $data->{user}{id}, name => $data->{user}{display_name})
6869
);
6970
}

lib/MusicBrainz/Server/Data/Relationship.pm

+7
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,13 @@ sub insert
804804
$self->c->model('Series')->automatically_reorder($values->{entity1_id});
805805
}
806806

807+
$self->delete_entity_link_type_counts(
808+
$type0,
809+
$type1,
810+
$row->{entity0},
811+
$row->{entity1},
812+
);
813+
807814
return $self->_entity_class->new( id => $id );
808815
}
809816

lib/MusicBrainz/Server/Edit.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ sub TO_JSON {
337337
editor_id => $self->editor_id + 0,
338338
expires_time => datetime_to_iso8601($self->expires_time),
339339
historic_type => $self->can('historic_type') ? $self->historic_type + 0 : undef,
340-
id => $self->id + 0,
340+
id => $self->id ? $self->id + 0 : undef,
341341
is_loaded => boolean_to_json($self->is_loaded),
342342
is_open => boolean_to_json($self->is_open),
343343
$can_preview ? (preview => boolean_to_json($self->preview)) : (),

lib/MusicBrainz/Server/Edit/Relationship/Create.pm

+6-2
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,16 @@ sub build_display_data
174174
my $type1 = $self->data->{type1};
175175
my $model0 = type_to_model($type0);
176176
my $model1 = type_to_model($type1);
177-
my $entity0 = $loaded->{$model0}{gid_or_id($self->data->{entity0})} ||
177+
my $entity0_gid_or_id = gid_or_id($self->data->{entity0});
178+
my $loaded_entity_0 = $loaded->{$model0}{$entity0_gid_or_id} if $entity0_gid_or_id;
179+
my $entity0 = $loaded_entity_0 ||
178180
$self->c->model($model0)->_entity_class->new(
179181
id => 0,
180182
name => $self->data->{entity0}{name}
181183
);
182-
my $entity1 = $loaded->{$model1}{gid_or_id($self->data->{entity1})} ||
184+
my $entity1_gid_or_id = gid_or_id($self->data->{entity1});
185+
my $loaded_entity_1 = $loaded->{$model1}{$entity1_gid_or_id} if $entity1_gid_or_id;
186+
my $entity1 = $loaded_entity_1 ||
183187
$self->c->model($model1)->_entity_class->new(
184188
id => 0,
185189
name => $self->data->{entity1}{name}

lib/MusicBrainz/Server/Edit/Relationship/Delete.pm

+2-1
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,14 @@ sub build_display_data
133133

134134
# If no link type exists, we use the fake ID and ensure the next one doesn't clash
135135
my $link_type_id = $link_type->{id} // $link_type_fake_id++;
136+
my $loaded_link_type = $loaded->{LinkType}{ $link_type->{id} } if $link_type->{id};
136137

137138
my $link = MusicBrainz::Server::Entity::Link->new(
138139
type_id => $link_type_id,
139140
begin_date => MusicBrainz::Server::Entity::PartialDate->new_from_row($relationship->{link}{begin_date}),
140141
end_date => MusicBrainz::Server::Entity::PartialDate->new_from_row($relationship->{link}{end_date}),
141142
ended => $relationship->{link}{ended},
142-
type => $loaded->{LinkType}{$link_type->{id}} // MusicBrainz::Server::Entity::LinkType->new(
143+
type => $loaded_link_type // MusicBrainz::Server::Entity::LinkType->new(
143144
id => $link_type_id,
144145
entity0_type => $entity0_type,
145146
entity1_type => $entity1_type,

lib/MusicBrainz/Server/Edit/Release/AddCoverArt.pm

+8-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,13 @@ sub foreign_keys {
104104
sub build_display_data {
105105
my ($self, $loaded) = @_;
106106

107-
my $release = $loaded->{Release}{ $self->data->{entity}{id} } ||
107+
my $loaded_release = $loaded->{Release}{ $self->data->{entity}{id} };
108+
my $release = $loaded_release ||
109+
Release->new(
110+
id => $self->data->{entity}{id},
111+
name => $self->data->{entity}{name},
112+
);
113+
my $artwork_release = $loaded_release ||
108114
Release->new(
109115
gid => $self->data->{entity}{mbid},
110116
id => $self->data->{entity}{id},
@@ -115,7 +121,7 @@ sub build_display_data {
115121
? $self->c->model('CoverArt')->image_type_suffix($self->data->{cover_art_mime_type})
116122
: "jpg";
117123

118-
my $artwork = Artwork->new(release => $release,
124+
my $artwork = Artwork->new(release => $artwork_release,
119125
id => $self->data->{cover_art_id},
120126
comment => $self->data->{cover_art_comment},
121127
mime_type => $self->data->{cover_art_mime_type},

lib/MusicBrainz/Server/Entity/Artwork.pm

+5-1
Original file line numberDiff line numberDiff line change
@@ -101,22 +101,26 @@ sub filename
101101
sub image { my $self = shift; return $self->_url_prefix . "." . $self->suffix; }
102102
sub small_thumbnail { my $self = shift; return $self->_url_prefix . "-250.jpg"; }
103103
sub large_thumbnail { my $self = shift; return $self->_url_prefix . "-500.jpg"; }
104+
sub huge_thumbnail { my $self = shift; return $self->_url_prefix . "-1200.jpg"; }
104105

105106
# These accessors allow for requesting thumbnails directly from the IA,
106107
# bypassing our artwork redirect service. These are suitable for any <img>
107108
# tags in our templates, avoiding a pointless 307 redirect and preventing
108-
# our redirect service from becoming overloaded. The "250px"/"500px"/
109+
# our redirect service from becoming overloaded. The "250px"/"500px"/"1200px"
109110
# "original" links still point to the public API at coverartarchive.org via
110111
# small_thumbnail, large_thumbnail, etc.
111112
sub small_ia_thumbnail { shift->_ia_url_prefix . '_thumb250.jpg' }
112113
sub large_ia_thumbnail { shift->_ia_url_prefix . '_thumb500.jpg' }
114+
sub huge_ia_thumbnail { shift->_ia_url_prefix . '_thumb1200.jpg' }
113115

114116
sub TO_JSON {
115117
my ($self) = @_;
116118

117119
my $json = {
118120
comment => $self->comment,
119121
filename => $self->filename,
122+
huge_ia_thumbnail => $self->huge_ia_thumbnail,
123+
huge_thumbnail => $self->huge_thumbnail,
120124
image => $self->image,
121125
id => $self->id,
122126
large_ia_thumbnail => $self->large_ia_thumbnail,

lib/MusicBrainz/Server/Form/Collection.pm

+11-4
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,22 @@ sub options_type_id {
4545

4646
my $types = select_options_tree($self->ctx, 'CollectionType');
4747
my $collection = $self->init_object;
48+
my $type_filter;
4849

4950
if ($collection && blessed $collection) {
5051
my $entity_type = $collection->type->item_entity_type;
5152
unless ($self->ctx->model('Collection')->is_empty($entity_type, $collection->{id})) {
52-
my %valid_types =
53-
map { $_->id => 1 }
54-
$self->ctx->model('CollectionType')->find_by_entity_type($entity_type);
55-
$types = [grep {$valid_types{$_->{value}}} @$types];
53+
$type_filter = $entity_type;
5654
}
55+
} elsif ($collection && $collection->{allowed_entity_type}) {
56+
$type_filter = $collection->{allowed_entity_type};
57+
}
58+
59+
if (defined $type_filter) {
60+
my %valid_types =
61+
map { $_->id => 1 }
62+
$self->ctx->model('CollectionType')->find_by_entity_type($type_filter);
63+
$types = [grep {$valid_types{$_->{value}}} @$types];
5764
}
5865

5966
return $types;

lib/MusicBrainz/Server/WebService/Serializer/JSON/LD/Release.pm

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ sub medium_format {
100100
# case of it not being one of these few formats. I'm not sure of the
101101
# best mitigation for either problem.
102102
my $name;
103+
my $parent_format_id = $format->parent ? $format->parent->id : $format->parent_id;
103104
if ($name = $map{$format->id}) {
104105
return "http://schema.org/${name}Format";
105-
} elsif ($name = $map{$format->parent ? $format->parent->id : $format->parent_id}) {
106+
} elsif ($parent_format_id && ($name = $map{$parent_format_id})) {
106107
return "http://schema.org/${name}Format";
107108
}
108109
}

lib/MusicBrainz/Server/WebService/Serializer/JSON/LD/Utils.pm

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ sub artwork {
8787
($artwork->is_front ? (representativeOfPage => 'True') : ()),
8888
thumbnail => [
8989
{'@type' => 'ImageObject', contentUrl => $artwork->small_thumbnail, encodingFormat => 'jpg'},
90-
{'@type' => 'ImageObject', contentUrl => $artwork->large_thumbnail, encodingFormat => 'jpg'}
90+
{'@type' => 'ImageObject', contentUrl => $artwork->large_thumbnail, encodingFormat => 'jpg'},
91+
{'@type' => 'ImageObject', contentUrl => $artwork->huge_thumbnail, encodingFormat => 'jpg'}
9192
]
9293
};
9394
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"eslint-plugin-react": "7.20.6",
8282
"eslint-plugin-react-hooks": "4.1.2",
8383
"file-url": "2.0.2",
84-
"flow-bin": "0.147.0",
84+
"flow-bin": "0.148.0",
8585
"gettext-parser": "3.1.0",
8686
"http-proxy": "1.18.1",
8787
"jsdom": "13.2.0",

po/attributes.de.po

+26-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
msgid ""
4848
msgstr ""
4949
"Project-Id-Version: MusicBrainz\n"
50-
"PO-Revision-Date: 2021-03-25 07:22+0000\n"
50+
"PO-Revision-Date: 2021-04-14 20:05+0000\n"
5151
"Last-Translator: Nicolás Tamargo <email address hidden>\n"
5252
"Language-Team: German (http://www.transifex.com/musicbrainz/musicbrainz/language/de/)\n"
5353
"MIME-Version: 1.0\n"
@@ -3519,6 +3519,11 @@ msgid ""
35193519
"play."
35203520
msgstr "Bühnenmusik/Begleitmusik ist Musik, die (meist) als Hintergrund für ein Theaterstück geschrieben wird."
35213521

3522+
#: DB:area_type/name:9
3523+
msgctxt "area_type"
3524+
msgid "Indigenous territory / reserve"
3525+
msgstr ""
3526+
35223527
#: DB:place_type/name:5
35233528
msgctxt "place_type"
35243529
msgid "Indoor arena"
@@ -4476,6 +4481,11 @@ msgctxt "medium_format"
44764481
msgid "Microcassette"
44774482
msgstr "Mikrokassette"
44784483

4484+
#: DB:area_type/name:8
4485+
msgctxt "area_type"
4486+
msgid "Military base"
4487+
msgstr ""
4488+
44794489
#: DB:medium_format/name:6
44804490
msgctxt "medium_format"
44814491
msgid "MiniDisc"
@@ -6989,6 +6999,21 @@ msgid ""
69896999
"already be used for reference)"
69907000
msgstr "Für Bilder, die vor der Verwendung fürs Tagging überarbeitet werden müssen (aber möglicherweise bereits als Referenz verwendet werden können)"
69917001

7002+
#: DB:area_type/description:8
7003+
msgctxt "area_type"
7004+
msgid ""
7005+
"Used for any military bases that are large enough to be considered an area, "
7006+
"not just a place."
7007+
msgstr ""
7008+
7009+
#: DB:area_type/description:9
7010+
msgctxt "area_type"
7011+
msgid ""
7012+
"Used for semi-autonomous territories governed by indigenous peoples, such as"
7013+
" Indian reserves/reservations in North America and indigenous territories in"
7014+
" Central and South America."
7015+
msgstr ""
7016+
69927017
#: DB:work_attribute_type/name:17
69937018
msgctxt "work_attribute_type"
69947019
msgid "Usul (Ottoman, Turkish)"

po/attributes.el.po

+26-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
msgid ""
1010
msgstr ""
1111
"Project-Id-Version: MusicBrainz\n"
12-
"PO-Revision-Date: 2021-03-25 07:22+0000\n"
12+
"PO-Revision-Date: 2021-04-14 20:05+0000\n"
1313
"Last-Translator: Nicolás Tamargo <email address hidden>\n"
1414
"Language-Team: Greek (http://www.transifex.com/musicbrainz/musicbrainz/language/el/)\n"
1515
"MIME-Version: 1.0\n"
@@ -3481,6 +3481,11 @@ msgid ""
34813481
"play."
34823482
msgstr ""
34833483

3484+
#: DB:area_type/name:9
3485+
msgctxt "area_type"
3486+
msgid "Indigenous territory / reserve"
3487+
msgstr ""
3488+
34843489
#: DB:place_type/name:5
34853490
msgctxt "place_type"
34863491
msgid "Indoor arena"
@@ -4438,6 +4443,11 @@ msgctxt "medium_format"
44384443
msgid "Microcassette"
44394444
msgstr ""
44404445

4446+
#: DB:area_type/name:8
4447+
msgctxt "area_type"
4448+
msgid "Military base"
4449+
msgstr ""
4450+
44414451
#: DB:medium_format/name:6
44424452
msgctxt "medium_format"
44434453
msgid "MiniDisc"
@@ -6951,6 +6961,21 @@ msgid ""
69516961
"already be used for reference)"
69526962
msgstr ""
69536963

6964+
#: DB:area_type/description:8
6965+
msgctxt "area_type"
6966+
msgid ""
6967+
"Used for any military bases that are large enough to be considered an area, "
6968+
"not just a place."
6969+
msgstr ""
6970+
6971+
#: DB:area_type/description:9
6972+
msgctxt "area_type"
6973+
msgid ""
6974+
"Used for semi-autonomous territories governed by indigenous peoples, such as"
6975+
" Indian reserves/reservations in North America and indigenous territories in"
6976+
" Central and South America."
6977+
msgstr ""
6978+
69546979
#: DB:work_attribute_type/name:17
69556980
msgctxt "work_attribute_type"
69566981
msgid "Usul (Ottoman, Turkish)"

0 commit comments

Comments
 (0)