[mb-commits] branch, mbs-5748, created. MBS-5748: Only require an edit note during approval if other editors voted no
MusicBrainz Git Server <[email protected]> Tue, 22 Jan 2013 16:01:46 +0000
| Newsgroups | gmane.comp.audio.musicbrainz.cvs |
|---|---|
| Message-ID | <E1TxgIE-0005Qm-2G@wiley> |
The branch, mbs-5748 has been created
at 9a1a88e70101fc0b950743c7f1a5c880d4fdaf9f (commit)
- Log -----------------------------------------------------------------
commit 9a1a88e70101fc0b950743c7f1a5c880d4fdaf9f
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..b057da6 100644
--- a/lib/MusicBrainz/Server/Controller/Edit.pm
+++ b/lib/MusicBrainz/Server/Controller/Edit.pm
@@ -94,7 +94,7 @@ sub approve : Chained('load') RequireAuth(auto_editor)
$c->detach;
}
- if($edit->no_votes > 0) {
+ 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