[mb-commits] branch, data-nes, updated. Make /work/show action work for just the `work` table
MusicBrainz Git Server <[email protected]> Tue, 15 Jan 2013 13:10:10 +0000
| Newsgroups | gmane.comp.audio.musicbrainz.cvs |
|---|---|
| Message-ID | <E1Tv6HK-000525-Fi@wiley> |
The branch, data-nes has been updated
discards http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=043da94862e84b7e58081392a1b36dc1a20f1619 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=2ac68eb349bbe4786b9ac4969ec4017d6fe2e93a (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (043da94862e84b7e58081392a1b36dc1a20f1619)
\
N -- N -- N (2ac68eb349bbe4786b9ac4969ec4017d6fe2e93a)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Summary of changes:
lib/MusicBrainz/Server/Controller/Work.pm | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 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 2ac68eb349bbe4786b9ac4969ec4017d6fe2e93a
Author: Oliver Charles <[email protected]>
Date: Tue Jan 15 13:00:43 2013 +0000
Make /work/show action work for just the `work` table
diff --git a/lib/MusicBrainz/Server/Controller/Work.pm b/lib/MusicBrainz/Server/Controller/Work.pm
index 9086bd9..d9c44e2 100644
--- a/lib/MusicBrainz/Server/Controller/Work.pm
+++ b/lib/MusicBrainz/Server/Controller/Work.pm
@@ -12,33 +12,38 @@ use MusicBrainz::Server::Constants qw(
use MusicBrainz::Server::Translation qw( l );
with 'MusicBrainz::Server::Controller::Role::Load' => {
- model => 'Work',
+ model => 'NES::Work',
entity_name => 'work',
};
-with 'MusicBrainz::Server::Controller::Role::Annotation';
+# with 'MusicBrainz::Server::Controller::Role::Annotation';
with 'MusicBrainz::Server::Controller::Role::Alias';
with 'MusicBrainz::Server::Controller::Role::Details';
-with 'MusicBrainz::Server::Controller::Role::Relationship';
-with 'MusicBrainz::Server::Controller::Role::Rating';
-with 'MusicBrainz::Server::Controller::Role::Tag';
+# with 'MusicBrainz::Server::Controller::Role::Relationship';
+# with 'MusicBrainz::Server::Controller::Role::Rating';
with 'MusicBrainz::Server::Controller::Role::EditListing';
-with 'MusicBrainz::Server::Controller::Role::Cleanup';
-with 'MusicBrainz::Server::Controller::Role::WikipediaExtract';
+# with 'MusicBrainz::Server::Controller::Role::Cleanup';
+# with 'MusicBrainz::Server::Controller::Role::WikipediaExtract';
use aliased 'MusicBrainz::Server::Entity::ArtistCredit';
sub base : Chained('/') PathPart('work') CaptureArgs(0) { }
+################################################################################
+# with 'MusicBrainz::Server::Controller::Role::Tag';
+sub tag_async : Chained('load') { }
+sub tags : Chained('load') { }
+################################################################################
+
after 'load' => sub
{
my ($self, $c) = @_;
my $work = $c->stash->{work};
- $c->model('Work')->load_meta($work);
- $c->model('ISWC')->load_for_works($work);
- if ($c->user_exists) {
- $c->model('Work')->rating->load_user_ratings($c->user->id, $work);
- }
+ # $c->model('Work')->load_meta($work);
+ # $c->model('ISWC')->load_for_works($work);
+ # if ($c->user_exists) {
+ # $c->model('Work')->rating->load_user_ratings($c->user->id, $work);
+ # }
};
sub show : PathPart('') Chained('load')
@@ -49,13 +54,15 @@ sub show : PathPart('') Chained('load')
$c->model('WorkType')->load($work);
$c->model('Language')->load($work);
- # need to call relationships for overview page
- $self->relationships($c);
+ # Need to call relationships for overview page
+ # $self->relationships($c); NES
$c->stash->{template} = 'work/index.tt';
}
-for my $action (qw( relationships aliases tags details )) {
+# NES - originally:
+# for my $action (qw( relationships aliases tags details )) {
+for my $action (qw( aliases details )) {
after $action => sub {
my ($self, $c) = @_;
my $work = $c->stash->{work};
diff --git a/lib/MusicBrainz/Server/Data/NES/Work.pm b/lib/MusicBrainz/Server/Data/NES/Work.pm
index 57570bc..c3964c4 100644
--- a/lib/MusicBrainz/Server/Data/NES/Work.pm
+++ b/lib/MusicBrainz/Server/Data/NES/Work.pm
@@ -1,7 +1,7 @@
package MusicBrainz::Server::Data::NES::Work;
use Moose;
-use MusicBrainz::Server::Entity::NES::Work;
+use MusicBrainz::Server::Entity::Work;
with 'MusicBrainz::Server::Data::Role::NES';
@@ -22,11 +22,25 @@ sub create {
sub get_revision {
my ($self, $revision_id) = @_;
+ return _new_from_response(
+ $self->request('/work/view-revision', { revision => $revision_id }));
+}
+
+sub get_by_gid {
+ my ($self, $gid) = @_;
+ return _new_from_response(
+ $self->request('/work/find-latest', { mbid => $gid }))
+}
- my $response = $self->request('/work/view-revision', { revision => $revision_id });
+sub _new_from_response {
+ my ($response) = @_;
+ my %data = %{ $response->{data} };
+ return MusicBrainz::Server::Entity::Work->new(
+ name => $data{name},
+ comment => $data{comment},
+ type_id => $data{type},
+ language_id => $data{language},
- return MusicBrainz::Server::Entity::NES::Work->new(
- name => $response->{data}{name},
gid => $response->{mbid}
);
}
diff --git a/lib/MusicBrainz/Server/Entity/NES/Work.pm b/lib/MusicBrainz/Server/Entity/NES/Work.pm
deleted file mode 100644
index 685ad57..0000000
--- a/lib/MusicBrainz/Server/Entity/NES/Work.pm
+++ /dev/null
@@ -1,12 +0,0 @@
-package MusicBrainz::Server::Entity::NES::Work;
-use Moo;
-
-has gid => (
- is => 'ro'
-);
-
-has name => (
- is => 'ro'
-);
-
-1;
-----------------------------------------------------------------------
hooks/post-receive
--
mb_server