[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:01:02 +0000
| Newsgroups | gmane.comp.audio.musicbrainz.cvs |
|---|---|
| Message-ID | <E1Tv68U-0004tz-7F@wiley> |
The branch, data-nes has been updated
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=043da94862e84b7e58081392a1b36dc1a20f1619 (commit)
from http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=b64041e9db43433be5ef57abc583bc0ee90a2504 (commit)
Summary of changes:
lib/MusicBrainz/Server/Controller/Work.pm | 16 ++++++++--------
lib/MusicBrainz/Server/Data/NES/Work.pm | 22 ++++++++++++++++++----
lib/MusicBrainz/Server/Entity/NES/Work.pm | 12 ------------
3 files changed, 26 insertions(+), 24 deletions(-)
delete mode 100644 lib/MusicBrainz/Server/Entity/NES/Work.pm
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 043da94862e84b7e58081392a1b36dc1a20f1619
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..8edb981 100644
--- a/lib/MusicBrainz/Server/Controller/Work.pm
+++ b/lib/MusicBrainz/Server/Controller/Work.pm
@@ -12,18 +12,18 @@ 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::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';
@@ -34,8 +34,8 @@ after 'load' => sub
my ($self, $c) = @_;
my $work = $c->stash->{work};
- $c->model('Work')->load_meta($work);
- $c->model('ISWC')->load_for_works($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);
}
@@ -49,8 +49,8 @@ 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';
}
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