alf (red_alf) wrote in changelog,
alf
red_alf
changelog

[livejournal] r22956: LJSUP-13431: Antispam for edited entries...

Committer: afedorov
LJSUP-13431: Antispam for edited entries in the communities

U   trunk/bin/upgrading/en.dat
U   trunk/cgi-bin/ljprotocol.pl
U   trunk/htdocs/admin/entryprops.bml
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2012-09-21 14:46:12 UTC (rev 22955)
+++ trunk/bin/upgrading/en.dat	2012-09-21 16:14:31 UTC (rev 22956)
@@ -2463,6 +2463,27 @@
 esn.moderated_submission.subject|staleness=1
 esn.moderated_submission.subject=Moderated submission notification
 
+esn.moderated_edited_submission.body<<
+There has been a new submission into the community '[[community]]'
+which you moderate.
+
+Entry author [[user]] have updated [[subject]].
+
+
+Options:
+
+  - Accept or reject this submission
+    [[moderateurl]]
+  - View the entire moderation queue
+    [[viewurl]]
+
+--
+[[sitename]] Team
+[[siteroot]]
+.
+
+esn.moderated_edited_submission.subject=Moderated submission notification
+
 esn.month.day_apr|staleness=1
 esn.month.day_apr=April [[day]]
 

Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2012-09-21 14:46:12 UTC (rev 22955)
+++ trunk/cgi-bin/ljprotocol.pl	2012-09-21 16:14:31 UTC (rev 22956)
@@ -3162,6 +3162,9 @@
 
         if ($uowner->{'journaltype'} eq 'C' && $need_moderated && !$flags->{'nomod'}) {
 
+            my $entry = LJ::Entry->new($ownerid, jitemid => $itemid);
+            my $modid_old = $entry->prop("mod_queue_id");
+
             $req->{'_moderate'}->{'authcode'} = LJ::make_auth_code(15);
 
             # create tag <lj-embed> from HTML-tag <embed>
@@ -3185,7 +3188,16 @@
                 $uowner->do("DELETE FROM modlog WHERE journalid=$ownerid AND modid=$modid");
                 return fail($err, 501);
             }
+                
+            if ($modid_old) {
+                $uowner->do("DELETE FROM modlog WHERE journalid=$ownerid AND modid=$modid_old");
+                return fail($err, 501) if $uowner->err;
+                $uowner->do("DELETE FROM modblob WHERE journalid=$ownerid AND modid=$modid_old");
+                return fail($err, 501) if $uowner->err;
+            }
 
+            $entry->set_prop("mod_queue_id", $modid);
+
             # alert moderator(s)
             my $mods = LJ::load_rel_user($dbh, $ownerid, 'M') || [];
             if (@$mods) {
@@ -3217,7 +3229,7 @@
                     # TODO: html/plain text.
                     my $body = LJ::Lang::get_text(
                         $to->{'browselang'},
-                        'esn.moderated_submission.body', undef,
+                        'esn.moderated_edited_submission.body', undef,
                         {
                             user        => $u->{'user'},
                             subject     => $req->{'subject'},
@@ -3229,7 +3241,7 @@
                             viewurl     => "$LJ::SITEROOT/community/moderate.bml?authas=$uowner->{'user'}",
                         });
 
-                    my $subject = LJ::Lang::get_text($to->{'browselang'},'esn.moderated_submission.subject');
+                    my $subject = LJ::Lang::get_text($to->{'browselang'},'esn.moderated_edited_submission.subject');
 
                     LJ::send_mail({
                         'to'        => $to->{to},

Modified: trunk/htdocs/admin/entryprops.bml
===================================================================
--- trunk/htdocs/admin/entryprops.bml	2012-09-21 14:46:12 UTC (rev 22955)
+++ trunk/htdocs/admin/entryprops.bml	2012-09-21 16:14:31 UTC (rev 22956)
@@ -106,8 +106,12 @@
         $ret .= "<li><strong>$prop</strong>: $props{$prop}$extra</li><br />";
     }
     if ($entry->is_sticky) {
-        $ret .= "<li><strong>Post is sticky</strong>: Y";
+        $ret .= "<li><strong>Post is sticky</strong>: Y</li><br />";
     }
+    my $modid = $entry->prop("mod_queue_id");
+    if ($modid) {
+        $ret .= "<li><strong>New content in moderation queue</strong>: Yes, ID = $modid</li><br />";
+    }
     $ret .= "</ul>";
 
     return $ret;

Tags: afedorov, bml, dat, livejournal, pl, red_alf
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