Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[mb-commits] r8534 - in mb_server/trunk: cgi-bin cgi-bin/MusicBrainz/Server: msg#00026

audio.musicbrainz.cvs

Subject: [mb-commits] r8534 - in mb_server/trunk: cgi-bin cgi-bin/MusicBrainz/Server htdocs/user

Author: robert
Date: 2006-10-16 21:46:15 +0000 (Mon, 16 Oct 2006)
New Revision: 8534

Modified:
mb_server/trunk/cgi-bin/Moderation.pm
mb_server/trunk/cgi-bin/MusicBrainz/Server/Vote.pm
mb_server/trunk/cgi-bin/UserPreference.pm
mb_server/trunk/htdocs/user/preferences.html
Log:
Committing Dave's bug 788 patch: Mail on no vote preference. Fixes #788.


Modified: mb_server/trunk/cgi-bin/Moderation.pm
===================================================================
--- mb_server/trunk/cgi-bin/Moderation.pm 2006-10-16 21:07:45 UTC (rev
8533)
+++ mb_server/trunk/cgi-bin/Moderation.pm 2006-10-16 21:46:15 UTC (rev
8534)
@@ -1049,6 +1049,45 @@
$thevote;
}

+sub FirstNoVote
+{
+ my ($self, $voter_uid) = @_;
+
+ require UserStuff;
+ my $editor = UserStuff->newFromId($self->{DBH}, $self->GetModerator);
+
+ require UserPreference;
+ my $send_mail = UserPreference::get_for_user('mail_on_first_no_vote',
$editor);
+ $send_mail or return;
+
+ my $url = "http://"; . &DBDefs::WEB_SERVER . "/show/edit/?editid=" .
$self->GetId;
+
+ my $body = <<EOF;
+Someone has voted against one of your edits:
+$url
+
+This email is only sent for the first "no" vote against your edit,
+not for each one. If you would prefer not to receive these emails,
+please log in and adjust your preferences accordingly.
+EOF
+
+ require MusicBrainz::Server::Mail;
+ my $mail = MusicBrainz::Server::Mail->new(
+ # Sender: not required
+ From => 'MusicBrainz <webserver@xxxxxxxxxxxxxxx>',
+ # To: $self (automatic)
+ "Reply-To" => 'MusicBrainz Support
<support@xxxxxxxxxxxxxxx>',
+ Subject => "Someone has voted against your edit",
+ References =>
'<edit-'.$self->GetId.'@'.&DBDefs::WEB_SERVER.'>',
+ Type => "text/plain",
+ Encoding => "quoted-printable",
+ Data => $body,
+ );
+ $mail->attr("content-type.charset" => "utf-8");
+
+ $editor->SendFormattedEmail(entity => $mail);
+}
+

################################################################################

sub TopModerators

Modified: mb_server/trunk/cgi-bin/MusicBrainz/Server/Vote.pm
===================================================================
--- mb_server/trunk/cgi-bin/MusicBrainz/Server/Vote.pm 2006-10-16 21:07:45 UTC
(rev 8533)
+++ mb_server/trunk/cgi-bin/MusicBrainz/Server/Vote.pm 2006-10-16 21:46:15 UTC
(rev 8534)
@@ -64,12 +64,12 @@
# Lock the table so that the select-old / insert-new are atomic
$sql->Do("LOCK TABLE vote_open IN EXCLUSIVE MODE");

- my $status = $sql->SelectSingleValue(
- "SELECT status FROM moderation_open WHERE id = ?",
+ my $mod_row = $sql->SelectSingleRowHash(
+ "SELECT novotes, status FROM moderation_open WHERE id = ?",
$modid,
);

- (defined($status) and $status == STATUS_OPEN)
+ (defined($mod_row) and $mod_row->{status} == STATUS_OPEN)
or return;

# Find the user's previous (most recent) vote for this mod
@@ -112,6 +112,14 @@
$nodelta,
$modid,
);
+
+ if ($vote == VOTE_NO and $mod_row->{novotes} == 0)
+ {
+ require Moderation;
+ my $t = Moderation->new($self->{DBH});
+ my $edit = $t->CreateFromId($modid);
+ $edit->FirstNoVote($uid);
+ }
}

sub newFromModerationId

Modified: mb_server/trunk/cgi-bin/UserPreference.pm
===================================================================
--- mb_server/trunk/cgi-bin/UserPreference.pm 2006-10-16 21:07:45 UTC (rev
8533)
+++ mb_server/trunk/cgi-bin/UserPreference.pm 2006-10-16 21:46:15 UTC (rev
8534)
@@ -251,6 +251,7 @@
addpref('JSMoveFocus', '1', \&check_bool);
addpref('mail_notes_if_i_noted', 1, \&check_bool);
addpref('mail_notes_if_i_voted', 1, \&check_bool);
+addpref('mail_on_first_no_vote', 1, \&check_bool);
addpref('mod_add_album_inline', 0, \&check_bool);
addpref('mod_add_album_link', 0, \&check_bool);
addpref('mods_per_page', 10, sub { check_int(1,25,@_) });

Modified: mb_server/trunk/htdocs/user/preferences.html
===================================================================
--- mb_server/trunk/htdocs/user/preferences.html 2006-10-16 21:07:45 UTC
(rev 8533)
+++ mb_server/trunk/htdocs/user/preferences.html 2006-10-16 21:46:15 UTC
(rev 8534)
@@ -71,6 +71,7 @@
vote_show_novote
mail_notes_if_i_noted
mail_notes_if_i_voted
+ mail_on_first_no_vote
remove_recent_link_on_add
release_show_relationshipslinks
release_show_annotationlinks
@@ -220,12 +221,23 @@
%
$m->out(UserPreference::get('mail_notes_if_i_voted') ? ' checked="checked" ' :
"");
/>
<label for="pref_mail_notes_if_i_voted">
- When I vote on a edit, mail me
all future notes for that edit</label>
+ When I vote on an edit, mail me
all future notes for that edit.</label>
<br />
&nbsp; &nbsp;
(Note: only takes effect when
your most recent vote on a edit is either
yes or no - not "abstain")
</div>
+ <div>
+ <input type="checkbox"
name="mail_on_first_no_vote" id="pref_mail_on_first_no_vote"
+%
$m->out(UserPreference::get('mail_on_first_no_vote') ? ' checked="checked" ' :
"");
+ />
+ <label for="pref_mail_on_first_no_vote">
+ Mail me when one of my edits
gets a "no" vote.</label>
+ <br />
+ &nbsp; &nbsp;
+ (Note: the email is only sent
for the first "no" vote, not each one)
+ </div>
+

% unless ($ui->Current->IsNewbie)
% {


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
solaris.opensol...    editors.vim/200...    web.turbogears....    jakarta.ant.dev...    mathematics.max...    text.unicode.ge...    lang.ruby.core/...    xfce.announce/2...    network.centeri...    php.cvs.pear/20...    user-groups.lin...    kde.devel.quant...    file-systems.ar...    redhat.fedora.t...    apple.fink.auto...    gnome.orbit.gen...    qplus.devel/200...    culture.transpo...    video.dri.user/...    operators.nanog...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation