changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[livejournal] r21175: LJSUP-4311 (Send 'rejected entry' email ...

Committer: azateev
LJSUP-4311 (Send 'rejected entry' email notification to the moderator)
U   trunk/bin/upgrading/en.dat
U   trunk/bin/upgrading/proplists.dat
U   trunk/htdocs/community/moderate.bml
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2012-02-13 15:16:57 UTC (rev 21174)
+++ trunk/bin/upgrading/en.dat	2012-02-13 15:27:50 UTC (rev 21175)
@@ -3560,6 +3560,47 @@
 ml_filter_by_poster_me|staleness=1
 ml_filter_by_poster_me=Filter community by me
 
+moderation_queue.reject.email.body.html<<
+Dear [[user]],<br />
+<br />
+<p>A new entry submitted by [[poster]] to the community [[community]], which you moderate, has been rejected by [[moderator]] with the following reason:</p>
+[[reason]]
+<p>Rejected entry information:</p>
+<b>Time:</b> [[date]]<br />
+<b>Subject:</b> [[subject]]<br />
+<b>Text:</b><br />
+<hr>
+[[text]]
+<hr>
+This notification is simply to make you aware of this rejected entry. Please contact the listed moderator if you have any questions or concerns about their decision to reject this entry.<br />
+<br />
+Regards,<br />
+[[sitename]] Team
+.
+
+moderation_queue.reject.email.body.plain<<
+Dear [[user]],
+
+A new entry submitted by "[[poster]]" (http://[[poster]].livejournal.com/profile) to the community "[[community]]" (http://[[community]].livejournal.com/profile), which you moderate has been rejected by "[[moderator]]" (http://[[moderator]].livejournal.com/profile) with the following reason:
+
+[[reason]]
+
+Rejected entry information:
+
+Time: [[date]]
+Subject: [[subject]]
+Text:
+--------------------------
+[[text]]
+--------------------------
+This notification is simply to make you aware of this rejected entry. Please contact the listed moderator if you have any questions or concerns about their decision to reject this entry.
+
+Regards,
+[[sitename]] Team
+.
+
+moderation_queue.reject.email.subject=New entry has been rejected from moderation
+
 multisearch.error.no_query|staleness=1
 multisearch.error.no_query=There is no any query provided
 

Modified: trunk/bin/upgrading/proplists.dat
===================================================================
--- trunk/bin/upgrading/proplists.dat	2012-02-13 15:16:57 UTC (rev 21174)
+++ trunk/bin/upgrading/proplists.dat	2012-02-13 15:27:50 UTC (rev 21175)
@@ -1785,3 +1785,10 @@
   datatype: char
   des: highest interval in ratings [SUP|UA|NONCYR]
   prettyname: highest interval in ratings
+
+userproplist.opt_modrejectemail:
+  cldversion: 8
+  datatype: bool
+  des: 0: default, do not send emails about rejection from moderation, 1: send them
+  indexed: 0
+  prettyname: Send emails about rejection from moderation
\ No newline at end of file

Modified: trunk/htdocs/community/moderate.bml
===================================================================
--- trunk/htdocs/community/moderate.bml	2012-02-13 15:16:57 UTC (rev 21174)
+++ trunk/htdocs/community/moderate.bml	2012-02-13 15:27:50 UTC (rev 21175)
@@ -115,6 +115,7 @@
         $do_mail = 1 unless $poster->is_visible;
 
         # mail the poster
+        my $etime;
         if ($do_mail) {
             my $subject="Moderated submission notification";
             my $to = $poster->email_raw;
@@ -131,7 +132,7 @@
             }
             unless ($why_mail eq 'success') {
                 $body .= "This is the message you submitted:\n\n";
-                my $etime = sprintf("%04d-%02d-%02d %02d:%02d",
+                $etime = sprintf("%04d-%02d-%02d %02d:%02d",
                                     $req->{'year'}, $req->{'mon'},
                                     $req->{'day'}, $req->{'hour'},
                                     $req->{'min'});
@@ -158,6 +159,70 @@
             });
         }
 
+        #mail moderators
+        if ($why_mail eq 'reject') {
+            my $dbh = LJ::get_db_writer();
+            my $mods = LJ::load_rel_user($dbh, $cid, 'M') || [];
+            if (@$mods) {
+                # load up all these mods and figure out 
+                # if they want email or not
+                my $modlist = LJ::load_userids(@$mods);
+                my @emails;
+                foreach my $mod (values %$modlist) {
+                    
+                    next unless $mod->is_visible;
+                    next if $mod->email_status ne "A";
+                    next unless $mod->prop('opt_modrejectemail');
+
+                    my $subject = LJ::Lang::get_text(
+                                    $mod->prop('browselang'),
+                                    'moderation_queue.reject.email.subject'
+                                  );
+                    my $body_m = LJ::Lang::get_text(
+                                    $mod->prop('browselang'),
+                                    'moderation_queue.reject.email.body.plain',
+                                    undef, {
+                                            user        => $mod->user,
+                                            poster      => $poster->user,
+                                            moderator   => $remote->user,
+                                            community   => $c->user,
+                                            date        => $etime,
+                                            subject     => $req->{subject},
+                                            text        => $req->{event},    
+                                            reason      => $POST{why},
+                                            sitename    => $LJ::SITENAME,
+                                           }
+                                 );
+                    my $html = ($mod->{opt_htmlemail} eq 'N')? 
+                        '' : 
+                        LJ::Lang::get_text(
+                            $mod->prop('browselang'),
+                            'moderation_queue.reject.email.body.html', 
+                            undef, {
+                                    user        => $mod->ljuser_display,
+                                    poster      => $poster->ljuser_display,
+                                    moderator   => $remote->ljuser_display,
+                                    community   => $c->ljuser_display,
+                                    date        => $etime,
+                                    subject     => $req->{subject},
+                                    text        => LJ::ehtml($req->{event}),    
+                                    reason      => $POST{why},
+                                    sitename    => $LJ::SITENAME,
+                                   }
+                        );                
+
+                    LJ::send_mail({
+                        'to'        => $mod->email_raw,
+                        'from'      => $LJ::DONOTREPLY_EMAIL,
+                        'charset'   => $mod->mailencoding || 'utf-8',
+                        'subject'   => $subject,
+                        'body'      => $body_m,
+                        'html'      => $html,
+                    });
+                }
+            }
+        }
+        
         if ($success) {
             $saved_comm = $c->{'user'};
             $saved_modid = 0;

Tags: azateev, bml, changelog_bot, dat, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments