[mb-commits] branch, beta, updated. Merge branch 'master' into beta Bump DB_SCHEMA_SEQUENCE from 15 to 16.

MusicBrainz Git Server <[email protected]>
Newsgroups gmane.comp.audio.musicbrainz.cvs
Message-ID <E1TUMwn-00064t-T0@wiley>
The branch, beta has been updated
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=4ee0f2f65f57f2876a6893c001ca0f202c92a310 (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=a3b03ca6774eeaf5352e5bf15c5392e5c6607651 (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=e6b6b10b5a1341c1fd4ee580a3e96f47c2c26cfb (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=85a17211b2b45abb411c8f8c146c3f52d5fdc743 (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=2af78f28ec809e48614fa5ed79d5442ed6489a5a (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=dada2a90a2df45f747e0c31c7935799d031eeaa8 (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=8a23dc170edc2b0c9c33107ed016a75eadad30fa (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=5673b0dac819d50228e9f7cb1322cefb3102192a (commit)
      from  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=27eeb63dfdd5a015861aed7628382877474d9e00 (commit)

Summary of changes:
 lib/DBDefs.pm.default                       |    2 +-
 lib/MusicBrainz/Server.pm                   |    6 ++++++
 lib/MusicBrainz/Server/Controller/Artist.pm |    7 +++++++
 lib/MusicBrainz/Server/Controller/Root.pm   |    3 ++-
 4 files changed, 16 insertions(+), 2 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 4ee0f2f65f57f2876a6893c001ca0f202c92a310
Merge: a3b03ca 2af78f2
Author: Ian McEwen <[email protected]>
Date:   Fri Nov 2 12:30:17 2012 -0700

    Merge branch 'master' into beta


commit a3b03ca6774eeaf5352e5bf15c5392e5c6607651
Merge: e6b6b10 85a1721
Author: Ian McEwen <[email protected]>
Date:   Fri Nov 2 12:30:01 2012 -0700

    Merge branch 'mbs-5509-language-persistence' into beta
    
    Conflicts:
    	lib/MusicBrainz/Server.pm

diff --cc lib/MusicBrainz/Server.pm
index 0334947,a61496a..087c891
--- a/lib/MusicBrainz/Server.pm
+++ b/lib/MusicBrainz/Server.pm
@@@ -307,60 -330,24 +312,61 @@@ sub execute 
      };
  }
  
 -sub finalize_error {
 +around 'finalize_error' => sub {
 +    my $orig = shift;
 +    my $c = shift;
 +
 +    with_translations($c, sub {
 +        my $c = shift;
 +        my $orig = shift;
 +
 +        $c->$orig(@_);
 +
 +        $c->model('MB')->context->connector->disconnect;
 +
 +        if (!$c->debug && scalar @{ $c->error }) {
 +            $c->stash->{errors} = $c->error;
 +            $c->stash->{template} = 'main/500.tt';
 +            $c->stash->{stack_trace} = $c->_stacktrace;
 +            $c->clear_errors;
 +            $c->res->{body} = 'clear';
 +            $c->view('Default')->process($c);
 +            $c->res->{body} = encode('utf-8', $c->res->{body});
 +        }
 +    }, $orig, @_);
 +};
 +
 +sub with_translations {
      my $c = shift;
 +    my $orig = shift;
  
 -    $c->next::method(@_);
 +    $_->instance->build_languages_from_header($c->req->headers)
 +        for qw( MusicBrainz::Server::Translation
 +                MusicBrainz::Server::Translation::Statistics
 +                MusicBrainz::Server::Translation::Countries
 +                MusicBrainz::Server::Translation::Scripts
 +                MusicBrainz::Server::Translation::Languages
 +                MusicBrainz::Server::Translation::Attributes
 +                MusicBrainz::Server::Translation::Relationships
 +                MusicBrainz::Server::Translation::Instruments
 +                MusicBrainz::Server::Translation::InstrumentDescriptions );
 +
 +    my $cookie_lang = Translation->instance->language_from_cookie($c->request->cookies->{lang});
++    $c->set_language_cookie($c->request->cookies->{lang}->value) if defined $c->request->cookies->{lang};
 +    my $lang = Translation->instance->set_language($cookie_lang);
 +    # because s///r is a perl 5.14 feature
 +    my $html_lang = $lang;
 +    $html_lang =~ s/_([A-Z]{2})/-\L$1/;
 +    $c->stash(
 +        current_language => $lang,
 +        current_language_html => $html_lang,
 +        use_languages => scalar @{ Translation->instance->all_languages() }
 +    );
  
 -    $c->model('MB')->context->connector->disconnect;
 +    &$orig($c, @_);
  
 -    if (!$c->debug && scalar @{ $c->error }) {
 -        $c->stash->{errors} = $c->error;
 -        $c->stash->{template} = 'main/500.tt';
 -        $c->stash->{stack_trace} = $c->_stacktrace;
 -        $c->clear_errors;
 -        $c->res->{body} = 'clear';
 -        $c->view('Default')->process($c);
 -        $c->res->{body} = encode('utf-8', $c->res->{body});
 -    }
 +    Translation->instance->unset_language();
  }
 -
  =head1 NAME
  
  MusicBrainz::Server - Catalyst-based MusicBrainz server

commit e6b6b10b5a1341c1fd4ee580a3e96f47c2c26cfb
Merge: 27eeb63 8a23dc1
Author: Ian McEwen <[email protected]>
Date:   Fri Nov 2 12:27:15 2012 -0700

    Merge branch 'mbs-5431-merge-deleted-artist' into beta


commit 85a17211b2b45abb411c8f8c146c3f52d5fdc743
Author: Ian McEwen <[email protected]>
Date:   Wed Oct 31 12:26:48 2012 -0700

    MBS-5509: deduplicate cookie generation/refreshing

diff --git a/lib/MusicBrainz/Server.pm b/lib/MusicBrainz/Server.pm
index 4d3289a..a61496a 100644
--- a/lib/MusicBrainz/Server.pm
+++ b/lib/MusicBrainz/Server.pm
@@ -260,8 +260,7 @@ around 'dispatch' => sub {
 
     my $cookie_lang = Translation->instance->language_from_cookie($c->request->cookies->{lang});
     # refresh the cookie
-    $c->res->cookies->{lang} = { 'value' => $c->request->cookies->{lang}->value, 'path' => '/', 'expires' => time()+31536000 }
-        if defined $c->request->cookies->{lang};
+    $c->set_language_cookie($c->request->cookies->{lang}->value) if defined $c->request->cookies->{lang};
     my $lang = Translation->instance->set_language($cookie_lang);
     # because s///r is a perl 5.14 feature
     my $html_lang = $lang;
@@ -300,6 +299,11 @@ sub gettext  { shift; Translation->instance->gettext(@_) }
 sub pgettext { shift; Translation->instance->pgettext(@_) }
 sub ngettext { shift; Translation->instance->ngettext(@_) }
 
+sub set_language_cookie {
+    my ($c, $lang) = @_;
+    $c->res->cookies->{lang} = { 'value' => $lang, 'path' => '/', 'expires' => time()+31536000 };
+}
+
 sub _handle_param_unicode_decoding {
     my ( $self, $value ) = @_;
     my $enc = $self->encoding;
diff --git a/lib/MusicBrainz/Server/Controller/Root.pm b/lib/MusicBrainz/Server/Controller/Root.pm
index fd4796d..7583cf2 100644
--- a/lib/MusicBrainz/Server/Controller/Root.pm
+++ b/lib/MusicBrainz/Server/Controller/Root.pm
@@ -61,7 +61,7 @@ sub set_language : Path('set-language') Args(1)
         $c->res->cookies->{lang} = { 'value' => '', 'path' => '/', 'expires' => time()-86400 };
     } else {
         # set the cookie to expire in a year
-        $c->res->cookies->{lang} = { 'value' => $lang, 'path' => '/', 'expires' => time()+31536000 };
+        $c->set_language_cookie($lang);
     }
     $c->res->redirect($c->req->referer || $c->uri_for('/'));
     $c->detach;

commit dada2a90a2df45f747e0c31c7935799d031eeaa8
Author: Ian McEwen <[email protected]>
Date:   Tue Oct 30 18:12:48 2012 -0700

    MBS-5509: set cookie expiration at a year, and re-set the cookie regularly

diff --git a/lib/MusicBrainz/Server.pm b/lib/MusicBrainz/Server.pm
index a1fc0b7..4d3289a 100644
--- a/lib/MusicBrainz/Server.pm
+++ b/lib/MusicBrainz/Server.pm
@@ -259,6 +259,9 @@ around 'dispatch' => sub {
 		MusicBrainz::Server::Translation::InstrumentDescriptions );
 
     my $cookie_lang = Translation->instance->language_from_cookie($c->request->cookies->{lang});
+    # refresh the cookie
+    $c->res->cookies->{lang} = { 'value' => $c->request->cookies->{lang}->value, 'path' => '/', 'expires' => time()+31536000 }
+        if defined $c->request->cookies->{lang};
     my $lang = Translation->instance->set_language($cookie_lang);
     # because s///r is a perl 5.14 feature
     my $html_lang = $lang;
diff --git a/lib/MusicBrainz/Server/Controller/Root.pm b/lib/MusicBrainz/Server/Controller/Root.pm
index fe4cad9..fd4796d 100644
--- a/lib/MusicBrainz/Server/Controller/Root.pm
+++ b/lib/MusicBrainz/Server/Controller/Root.pm
@@ -60,7 +60,8 @@ sub set_language : Path('set-language') Args(1)
         # force the cookie to expire
         $c->res->cookies->{lang} = { 'value' => '', 'path' => '/', 'expires' => time()-86400 };
     } else {
-        $c->res->cookies->{lang} = { 'value' => $lang, 'path' => '/' };
+        # set the cookie to expire in a year
+        $c->res->cookies->{lang} = { 'value' => $lang, 'path' => '/', 'expires' => time()+31536000 };
     }
     $c->res->redirect($c->req->referer || $c->uri_for('/'));
     $c->detach;

commit 8a23dc170edc2b0c9c33107ed016a75eadad30fa
Author: Ian McEwen <[email protected]>
Date:   Mon Oct 8 13:18:27 2012 -0700

    MBS-5431: Use 'any' rather than 'grep'

diff --git a/lib/MusicBrainz/Server/Controller/Artist.pm b/lib/MusicBrainz/Server/Controller/Artist.pm
index 39549a2..1696859 100644
--- a/lib/MusicBrainz/Server/Controller/Artist.pm
+++ b/lib/MusicBrainz/Server/Controller/Artist.pm
@@ -42,6 +42,8 @@ use MusicBrainz::Server::FilterUtils qw(
 );
 use Sql;
 
+use List::AllUtils qw( any );
+
 my $COLLABORATION = '75c09861-6857-4ec0-9729-84eefde7fc86';
 
 =head1 NAME
@@ -520,7 +522,7 @@ around _validate_merge => sub {
         return 0;
     }
 
-    if (grep { $DARTIST_ID } $merger->all_entities) {
+    if (any { $_ == $DARTIST_ID } $merger->all_entities) {
         $form->field('target')->add_error(l('You cannot merge into Deleted Artist'));
         return 0;
     }

commit 5673b0dac819d50228e9f7cb1322cefb3102192a
Author: Ian McEwen <[email protected]>
Date:   Sun Oct 7 19:16:15 2012 -0700

    MBS-5431: Disallow merges into Deleted Artist

diff --git a/lib/MusicBrainz/Server/Controller/Artist.pm b/lib/MusicBrainz/Server/Controller/Artist.pm
index abe1db9..39549a2 100644
--- a/lib/MusicBrainz/Server/Controller/Artist.pm
+++ b/lib/MusicBrainz/Server/Controller/Artist.pm
@@ -520,6 +520,11 @@ around _validate_merge => sub {
         return 0;
     }
 
+    if (grep { $DARTIST_ID } $merger->all_entities) {
+        $form->field('target')->add_error(l('You cannot merge into Deleted Artist'));
+        return 0;
+    }
+
     return 1;
 };
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
mb_server
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.