[mb-commits] branch, beta, updated. Merge branch 'mbs-5666-abstention-emailing' into beta MBS-5666: don' t email e...
MusicBrainz Git Server <[email protected]> Mon, 04 Feb 2013 14:06:11 +0000
| Newsgroups | gmane.comp.audio.musicbrainz.cvs |
|---|---|
| Message-ID | <E1U2MgV-0001Yh-2X@wiley> |
The branch, beta has been updated
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=53a71bd8b7ec5d3b3224379d0474dc9b99f3a328 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=578bc7c099628c6a11eebf8fe7a8816a9b831b0a (commit)
from http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=92c7dd03557fbb80940a66452df7e37bed48898f (commit)
Summary of changes:
lib/MusicBrainz/Server/Data/EditNote.pm | 3 ++-
t/lib/t/MusicBrainz/Server/Data/EditNote.pm | 7 +++++--
t/sql/edit_note.sql | 3 ++-
3 files changed, 9 insertions(+), 4 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 53a71bd8b7ec5d3b3224379d0474dc9b99f3a328
Merge: 92c7dd0 578bc7c
Author: Ian McEwen <[email protected]>
Date: Mon Feb 4 10:02:15 2013 -0700
Merge branch 'mbs-5666-abstention-emailing' into beta
* mbs-5666-abstention-emailing:
MBS-5666: don't email editors when they abstain on an edit, as in pre-NGS
commit 578bc7c099628c6a11eebf8fe7a8816a9b831b0a
Author: Ian McEwen <[email protected]>
Date: Thu Jan 17 19:00:13 2013 -0700
MBS-5666: don't email editors when they abstain on an edit, as in pre-NGS
diff --git a/lib/MusicBrainz/Server/Data/EditNote.pm b/lib/MusicBrainz/Server/Data/EditNote.pm
index 3ae226f..87dc696 100644
--- a/lib/MusicBrainz/Server/Data/EditNote.pm
+++ b/lib/MusicBrainz/Server/Data/EditNote.pm
@@ -9,6 +9,7 @@ use MusicBrainz::Server::Data::Utils qw(
placeholders
query_to_list
);
+use MusicBrainz::Server::Constants qw( :vote );
extends 'MusicBrainz::Server::Data::Entity';
@@ -89,7 +90,7 @@ sub add_note
map { $_->id } grep { $_->preferences->email_on_notes }
map { $editors->{$_->editor_id} }
@{ $edit->edit_notes },
- @{ $edit->votes },
+ (grep { $_->vote != $VOTE_ABSTAIN } @{ $edit->votes }),
$edit;
my $from = $editors->{ $note_hash->{editor_id} };
diff --git a/t/lib/t/MusicBrainz/Server/Data/EditNote.pm b/t/lib/t/MusicBrainz/Server/Data/EditNote.pm
index 54fc51f..9a15e75 100644
--- a/t/lib/t/MusicBrainz/Server/Data/EditNote.pm
+++ b/t/lib/t/MusicBrainz/Server/Data/EditNote.pm
@@ -121,17 +121,20 @@ lives_ok {
$en_data->insert($edit->id, {
editor_id => 3,
text => 'Note' })
-};
+} "Edit notes don't die while in a transaction already";
$test->c->sql->commit;
# Test adding edit notes with email sending
$test->c->model('Vote')->enter_votes(2, { edit_id => $edit->id, vote => 1 });
+# Add an abstain -- this should *not* send email
+$test->c->model('Vote')->enter_votes(4, { edit_id => $edit->id, vote => -1 });
+
$en_data->add_note($edit->id, { text => "This is my note!", editor_id => 3 });
my $server = DBDefs->WEB_SERVER_USED_IN_EMAIL;
my $email_transport = MusicBrainz::Server::Email->get_test_transport;
-is($email_transport->delivery_count, 2);
+is($email_transport->delivery_count, 2, 'Exactly two emails sent (none for an abstain)');
my $email2 = $email_transport->shift_deliveries->{email};
my $email = $email_transport->shift_deliveries->{email};
diff --git a/t/sql/edit_note.sql b/t/sql/edit_note.sql
index 914f2dd..c2f8310 100644
--- a/t/sql/edit_note.sql
+++ b/t/sql/edit_note.sql
@@ -6,5 +6,6 @@ SET client_min_messages TO 'warning';
INSERT INTO editor (id, name, password, email)
VALUES (1, 'editor1', 'pass', '[email protected]'),
(2, 'editor2', 'pass', '[email protected]'),
- (3, 'editor3', 'pass', '[email protected]');
+ (3, 'editor3', 'pass', '[email protected]'),
+ (4, 'editor4', 'pass', '[email protected]');
-----------------------------------------------------------------------
hooks/post-receive
--
mb_server