vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r15615: LJSUP-4764: PingBack comments should be ...

Committer: vsukhanov
LJSUP-4764: PingBack comments should be created as screened, not switched to this state right after creation.

U   trunk/cgi-bin/LJ/Comment.pm
U   trunk/cgi-bin/LJ/PingBack.pm
U   trunk/cgi-bin/talklib.pl
Modified: trunk/cgi-bin/LJ/Comment.pm
===================================================================
--- trunk/cgi-bin/LJ/Comment.pm	2009-08-19 18:41:36 UTC (rev 15614)
+++ trunk/cgi-bin/LJ/Comment.pm	2009-08-20 03:24:07 UTC (rev 15615)
@@ -138,7 +138,7 @@
     # %talk_opts emulates parameters received from web form.
     # Fill it with nessesary options.
     my %talk_opts = map { $_ => delete $opts{$_} }
-                    qw(nodetype parenttalkid body subject props);
+                    qw(nodetype parenttalkid body subject props state);
 
     # poster and journal should be $u objects,
     # but talklib wants usernames... we'll map here

Modified: trunk/cgi-bin/LJ/PingBack.pm
===================================================================
--- trunk/cgi-bin/LJ/PingBack.pm	2009-08-19 18:41:36 UTC (rev 15614)
+++ trunk/cgi-bin/LJ/PingBack.pm	2009-08-20 03:24:07 UTC (rev 15615)
@@ -45,6 +45,7 @@
                     : ($title || BML::ml("pingback.sourceURI.default_title"));
 
     my $comment = LJ::Comment->create(
+                    state        => 'S', # this comment should be 'Screened'
                     journal      => $target_entry->journal,
                     ditemid      => $target_entry->ditemid,
                     poster       => $poster_u,

Modified: trunk/cgi-bin/talklib.pl
===================================================================
--- trunk/cgi-bin/talklib.pl	2009-08-19 18:41:36 UTC (rev 15614)
+++ trunk/cgi-bin/talklib.pl	2009-08-20 03:24:07 UTC (rev 15615)
@@ -2808,8 +2808,8 @@
 
 sub init {
     my ($form, $remote, $need_captcha, $errret) = @_;
-    my $sth;
-
+    my $sth = undef;
+    
     my $err = sub {
         my $error = shift;
         push @$errret, $error;
@@ -3184,15 +3184,21 @@
         $subjecticon = LJ::trim(lc($form->{'subjecticon'}));
     }
 
-    # figure out whether to post this comment screened
+    # New comment state
     my $state = 'A';
-    my $screening = LJ::Talk::screening_level($journalu, int($ditemid / 256));
-    if (!$form->{editid} && ($screening eq 'A' ||
-        ($screening eq 'R' && ! $up) ||
-        ($screening eq 'F' && !($up && LJ::is_friend($journalu, $up))))) {
-        $state = 'S';
+    if ($form->{state} =~ /^[A-Z]\z/){
+        # use provided state.
+        $state = $form->{state};
+    } else {
+        # figure out whether to post this comment screened
+        my $screening = LJ::Talk::screening_level($journalu, int($ditemid / 256));
+        if (!$form->{editid} && ($screening eq 'A' ||
+            ($screening eq 'R' && ! $up) ||
+            ($screening eq 'F' && !($up && LJ::is_friend($journalu, $up))))) {
+            $state = 'S';
+        }
+        $state = 'A' if LJ::Talk::can_unscreen($up, $journalu, $init->{entryu}, $init->{entryu}{user});
     }
-    $state = 'A' if LJ::Talk::can_unscreen($up, $journalu, $init->{entryu}, $init->{entryu}{user});
 
     my $parent = {
         state     => $parpost->{state},

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