Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

MBS-5748: Only require an edit note during approval if other editors voted no #21

Closed
wants to merge 1 commit into from

3 participants

@ocharles
Owner

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.

@ocharles ocharles 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.
e4ac810
@warpr
Owner

:shipit:

@ocharles ocharles closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 22, 2013
  1. @ocharles

    MBS-5748: Only require an edit note during approval if other editors …

    ocharles authored
    …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.
This page is out of date. Refresh to see the latest.
View
3  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 }) {
View
10 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_*
Something went wrong with that request. Please try again.