[mb-commits] branch, mbs-5748, updated. MBS-5748: Only require an edit note during approval if other editors voted no

MusicBrainz Git Server <[email protected]> Tue, 22 Jan 2013 16:16:34 +0000
Newsgroups gmane.comp.audio.musicbrainz.cvs
Message-ID <E1TxgWY-0005dS-9p@wiley>
The branch, mbs-5748 has been updated
  discards  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=9a1a88e70101fc0b950743c7f1a5c880d4fdaf9f (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=e4ac8106300c74bb9fabd6910a0f3e52d85b3951 (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 (9a1a88e70101fc0b950743c7f1a5c880d4fdaf9f)
            \
             N -- N -- N (e4ac8106300c74bb9fabd6910a0f3e52d85b3951)

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/Edit.pm |    1 +
 1 files changed, 1 insertions(+), 0 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 e4ac8106300c74bb9fabd6910a0f3e52d85b3951
Author: Oliver Charles <[email protected]>
Date:   Tue Jan 22 15:58:32 2013 +0000

    MBS-5748: Only require an edit note during approval if other editors voted no
    
    We currently check that the no vote counter for an edit is >0. However, if the
    no vote is your own vote, then you shouldn't have to justify changing your vote
    to approval.

diff --git a/lib/MusicBrainz/Server/Controller/Edit.pm b/lib/MusicBrainz/Server/Controller/Edit.pm
index 1386e3e..cd5a63a 100644
--- a/lib/MusicBrainz/Server/Controller/Edit.pm
+++ b/lib/MusicBrainz/Server/Controller/Edit.pm
@@ -94,7 +94,8 @@ sub approve : Chained('load') RequireAuth(auto_editor)
         $c->detach;
     }
 
-    if($edit->no_votes > 0) {
+    $c->model('Vote')->load_for_edits($edit);
+    if($edit->approval_requires_comment($c->user)) {
         $c->model('EditNote')->load_for_edits($edit);
         my $left_note;
         for my $note (@{ $edit->edit_notes }) {
diff --git a/lib/MusicBrainz/Server/Edit.pm b/lib/MusicBrainz/Server/Edit.pm
index feefbeb..f69046a 100644
--- a/lib/MusicBrainz/Server/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit.pm
@@ -231,6 +231,16 @@ sub was_approved
     return scalar $self->_grep_votes(sub { $_->vote == $VOTE_APPROVE })
 }
 
+sub approval_requires_comment {
+    my ($self, $editor) = @_;
+
+    return $self->_grep_votes(sub {
+        $_->vote == $VOTE_NO &&
+            !$_->superseded &&
+                $_->editor_id != $editor->id
+    }) > 0;
+}
+
 =head2 related_entities
 
 A list of all entities that this edit relates to. For each entity, a row in the edit_*

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


hooks/post-receive
-- 
mb_server