[mb-commits] branch, data-nes, updated. Edit note support
MusicBrainz Git Server <[email protected]> Fri, 18 Jan 2013 15:34:10 +0000
| Newsgroups | gmane.comp.audio.musicbrainz.cvs |
|---|---|
| Message-ID | <E1TwDxK-00041P-IB@wiley> |
The branch, data-nes has been updated
discards http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=82cd2edc485e7270f20283e7d471cf9e966657e7 (commit)
discards http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=4cc33e4b023b264a1dbee4d297e13fdf74de3348 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=4f703b0add08028f14c18b09ebc16b3d6043542f (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 (82cd2edc485e7270f20283e7d471cf9e966657e7)
\
N -- N -- N (4f703b0add08028f14c18b09ebc16b3d6043542f)
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/Role/Alias.pm | 62 ++++++++---------------
lib/MusicBrainz/Server/Controller/Work.pm | 4 +-
lib/MusicBrainz/Server/Data/NES/Work.pm | 41 +---------------
lib/MusicBrainz/Server/Entity/Alias.pm | 4 +-
lib/MusicBrainz/Server/Entity/Tree/Work.pm | 5 --
lib/MusicBrainz/Server/Form/Alias.pm | 30 ++++++-----
lib/MusicBrainz/Server/NES/Controller/Utils.pm | 11 ++++
root/alias/edit_form.tt | 1 -
8 files changed, 54 insertions(+), 104 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 4f703b0add08028f14c18b09ebc16b3d6043542f
Author: Oliver Charles <[email protected]>
Date: Fri Jan 18 12:55:43 2013 +0000
Edit note support
diff --git a/lib/MusicBrainz/Server/Data/EditNote.pm b/lib/MusicBrainz/Server/Data/EditNote.pm
index 3ae226f..efe1da5 100644
--- a/lib/MusicBrainz/Server/Data/EditNote.pm
+++ b/lib/MusicBrainz/Server/Data/EditNote.pm
@@ -12,6 +12,8 @@ use MusicBrainz::Server::Data::Utils qw(
extends 'MusicBrainz::Server::Data::Entity';
+with 'MusicBrainz::Server::Data::Role::NES';
+
sub _table
{
return 'edit_note';
@@ -60,14 +62,13 @@ sub load_for_edits
sub insert
{
my ($self, $edit_id, $note_hash) = @_;
- my $mapping = $self->_column_mapping;
- my %r = map {
- my $key = $mapping->{$_} || $_;
- $key => $note_hash->{$_};
- } keys %$note_hash;
- $r{edit} = $edit_id;
- $self->sql->auto_commit;
- $self->sql->insert_row('edit_note', \%r);
+ $self->request(
+ '/edit/add-note', {
+ edit => $edit_id,
+ editor => $note_hash->{editor_id},
+ text => $note_hash->{text}
+ }
+ );
}
sub add_note
@@ -75,33 +76,34 @@ sub add_note
my ($self, $edit_id, $note_hash) = @_;
$self->insert($edit_id, $note_hash);
- my $email_data = MusicBrainz::Server::Email->new( c => $self->c );
- my $edit = $self->c->model('Edit')->get_by_id($edit_id) or die "Edit $edit_id does not exist!";
- $self->c->model('EditNote')->load_for_edits($edit);
- $self->c->model('Vote')->load_for_edits($edit);
- my $editors = $self->c->model('Editor')->get_by_ids($edit->editor_id,
- $note_hash->{editor_id},
- (map { $_->editor_id } @{ $edit->votes }),
- (map { $_->editor_id } @{ $edit->edit_notes }));
- $self->c->model('Editor')->load_preferences(values %$editors);
-
- my @to_email = grep { $_ != $note_hash->{editor_id} }
- map { $_->id } grep { $_->preferences->email_on_notes }
- map { $editors->{$_->editor_id} }
- @{ $edit->edit_notes },
- @{ $edit->votes },
- $edit;
-
- my $from = $editors->{ $note_hash->{editor_id} };
- for my $editor_id (uniq @to_email) {
- my $editor = $editors->{ $editor_id };
- $email_data->send_edit_note(
- from_editor => $from,
- editor => $editor,
- note_text => $note_hash->{text},
- edit_id => $edit_id,
- own_edit => $edit->editor_id == $editor->id);
- }
+ # NES
+ # my $email_data = MusicBrainz::Server::Email->new( c => $self->c );
+ # my $edit = $self->c->model('Edit')->get_by_id($edit_id) or die "Edit $edit_id does not exist!";
+ # $self->c->model('EditNote')->load_for_edits($edit);
+ # $self->c->model('Vote')->load_for_edits($edit);
+ # my $editors = $self->c->model('Editor')->get_by_ids($edit->editor_id,
+ # $note_hash->{editor_id},
+ # (map { $_->editor_id } @{ $edit->votes }),
+ # (map { $_->editor_id } @{ $edit->edit_notes }));
+ # $self->c->model('Editor')->load_preferences(values %$editors);
+
+ # my @to_email = grep { $_ != $note_hash->{editor_id} }
+ # map { $_->id } grep { $_->preferences->email_on_notes }
+ # map { $editors->{$_->editor_id} }
+ # @{ $edit->edit_notes },
+ # @{ $edit->votes },
+ # $edit;
+
+ # my $from = $editors->{ $note_hash->{editor_id} };
+ # for my $editor_id (uniq @to_email) {
+ # my $editor = $editors->{ $editor_id };
+ # $email_data->send_edit_note(
+ # from_editor => $from,
+ # editor => $editor,
+ # note_text => $note_hash->{text},
+ # edit_id => $edit_id,
+ # own_edit => $edit->editor_id == $editor->id);
+ # }
}
no Moose;
diff --git a/lib/MusicBrainz/Server/NES/Controller/Utils.pm b/lib/MusicBrainz/Server/NES/Controller/Utils.pm
index f066c42..ff5ff27 100644
--- a/lib/MusicBrainz/Server/NES/Controller/Utils.pm
+++ b/lib/MusicBrainz/Server/NES/Controller/Utils.pm
@@ -33,6 +33,17 @@ sub create_edit {
my $work = $opts{on_post}->($values, $edit);
+ if ($values->{edit_note}) {
+ $c->model('EditNote')->add_note(
+ $edit->id,
+ {
+ editor_id => $c->user->id,
+ text => $values->{edit_note}
+ }
+ );
+ }
+
+
# NES:
# my $privs = $c->user->privileges;
# if ($c->user->is_auto_editor &&
-----------------------------------------------------------------------
hooks/post-receive
--
mb_server