alf (red_alf) wrote in changelog,
alf
red_alf
changelog

[livejournal] r23015: iLJSUP-13431: Antispam for edited entrie...

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

U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2012-09-28 14:33:25 UTC (rev 23014)
+++ trunk/cgi-bin/ljprotocol.pl	2012-10-01 10:20:40 UTC (rev 23015)
@@ -3158,16 +3158,27 @@
     my $is_approved_user = LJ::RelationService->is_relation_type_to( $ownerid, $posterid, [ 'A','M','N' ] );
     unless ( $is_unsuspicious_user || $is_approved_user ) {
 
+        my $entry = LJ::Entry->new($ownerid, jitemid => $itemid);
+        my $modid_old = $entry->prop("mod_queue_id");
+
+        my $need_moderated_old = 0;
+
+        my $suspicious_list_old = {};
+        LJ::run_hook('spam_community_detector', $uowner, { event => $entry->event_html }, \$need_moderated_old, $suspicious_list_old);
+
         my $need_moderated = 0;
-        my $suspicious_list = [];
+
+        my $suspicious_list = {};
         if ( $uowner->check_non_whitelist_enabled() ) {
             LJ::run_hook('spam_community_detector', $uowner, $req, \$need_moderated, $suspicious_list);
         }
+        
+        foreach ( keys %$suspicious_list_old ) {
+            delete $suspicious_list->{$_};
+        }
 
         if ($uowner->{'journaltype'} eq 'C' && !$flags->{'nomod'}) {
 
-            my $entry = LJ::Entry->new($ownerid, jitemid => $itemid);
-            my $modid_old = $entry->prop("mod_queue_id");
             
             if ($need_moderated) {
 
@@ -3205,8 +3216,8 @@
                 $entry->set_prop("mod_queue_id", $modid);
             
                 my $suspicious_text = "";
-                foreach (@$suspicious_list) {
-                    $suspicious_text .= "   - $_->{type} - $_->{url}\n";
+                foreach ( sort keys %$suspicious_list ) {
+                    $suspicious_text .= "   - $suspicious_list->{$_}->{type} - $suspicious_list->{$_}->{url}\n";
                 }
 
                 # alert moderator(s)

Tags: afedorov, 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