[mb-commits] branch, mbs-5767, updated. Use clean_submitted_artist_credits to transform artist credit form fields
MusicBrainz Git Server <[email protected]> Tue, 22 Jan 2013 12:46:47 +0000
| Newsgroups | gmane.comp.audio.musicbrainz.cvs |
|---|---|
| Message-ID | <E1TxdFX-0002dV-DB@wiley> |
The branch, mbs-5767 has been updated
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=18b9364c4eb7ac1f5b94299225a7eb9bef01956a (commit)
from http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=ce4ae81b306abe97d97382b6f11ea484fd3018e8 (commit)
Summary of changes:
lib/MusicBrainz/Server/Form/Field/ArtistCredit.pm | 27 +++++++--------------
1 files changed, 9 insertions(+), 18 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 18b9364c4eb7ac1f5b94299225a7eb9bef01956a
Author: Oliver Charles <[email protected]>
Date: Tue Jan 22 12:46:20 2013 +0000
Use clean_submitted_artist_credits to transform artist credit form fields
diff --git a/lib/MusicBrainz/Server/Form/Field/ArtistCredit.pm b/lib/MusicBrainz/Server/Form/Field/ArtistCredit.pm
index b1bee3d..f92d38d 100644
--- a/lib/MusicBrainz/Server/Form/Field/ArtistCredit.pm
+++ b/lib/MusicBrainz/Server/Form/Field/ArtistCredit.pm
@@ -4,6 +4,7 @@ use Scalar::Util qw( looks_like_number );
use Text::Trim qw( );
extends 'HTML::FormHandler::Field::Compound';
+use MusicBrainz::Server::Edit::Utils qw( clean_submitted_artist_credits );
use MusicBrainz::Server::Entity::ArtistCredit;
use MusicBrainz::Server::Entity::ArtistCreditName;
use MusicBrainz::Server::Translation qw( l ln );
@@ -11,9 +12,14 @@ use MusicBrainz::Server::Translation qw( l ln );
has 'allow_unlinked' => ( isa => 'Bool', is => 'rw', default => '0' );
has_field 'names' => ( type => 'Repeatable', num_when_empty => 1 );
-has_field 'names.name' => ( type => 'Text');
+has_field 'names.name' => ( type => '+MusicBrainz::Server::Form::Field::Text');
has_field 'names.artist' => ( type => '+MusicBrainz::Server::Form::Field::Artist' );
-has_field 'names.join_phrase' => ( type => 'Text', trim => { transform => sub { shift } });
+has_field 'names.join_phrase' => (
+ # Can't use MusicBrainz::Server::Form::Field::Text as we need whitespace on the left
+ # and right.
+ type => 'Text',
+ trim => { transform => sub { shift } }
+);
around 'validate_field' => sub {
my $orig = shift;
@@ -89,22 +95,7 @@ around 'value' => sub {
return $ret unless $ret && $ret->{names};
- my @names = @{ $ret->{names} };
- for my $i (0 .. $#names)
- {
- $ret->{names}->[$i]->{name} = $ret->{names}->[$i]->{artist}->{name}
- if !$ret->{names}->[$i]->{name};
-
- if ($self->result->input)
- {
- # HTML::FormHandler incorrectly trims the join phrase if
- # it is a single space, work around this by taking the
- # join phrase directly from the input here.
- $ret->{names}->[$i]->{join_phrase} = $self->result->input->{names}->[$i]->{join_phrase};
- }
- }
-
- return $ret;
+ return clean_submitted_artist_credits($ret);
};
=head1 LICENSE
-----------------------------------------------------------------------
hooks/post-receive
--
mb_server