fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-04-29 08:21 am

[dw-free] Replying to entries in sitescheme gives error

[commit: http://hg.dwscoalition.org/dw-free/rev/1537a89bbc5c]

http://bugs.dwscoalition.org/show_bug.cgi?id=2568

Check whether we're replying to a top-level item (entry).

Patch by [personal profile] yvi.

Files modified:
  • htdocs/talkpost.bml
--------------------------------------------------------------------------------
diff -r 116bf9136f18 -r 1537a89bbc5c htdocs/talkpost.bml
--- a/htdocs/talkpost.bml	Thu Apr 29 01:15:28 2010 -0700
+++ b/htdocs/talkpost.bml	Thu Apr 29 01:26:27 2010 -0700
@@ -147,6 +147,7 @@ body<=
     # canonical link to the entry or comment thread
     $head .= LJ::canonical_link( $entry->url, $GET{replyto} );
 
+    my $toplevel = $parpost ? 0 : 1;
     $parpost ||= $item;  # if there's no parent post, remote is reply to top-level item
 
     my ($up, $ur);  # $up = user posted journal item; $ur = user remote is replying to
@@ -183,10 +184,14 @@ body<=
     return "<?h1 $ML{'talk.error.suspended.title'} h1?><?p " . BML::ml('talk.error.suspendedentryreply', { aopts => "href='" . $u->journal_base . "/'" }) . " p?>"
         if $entry && $entry->is_suspended;
 
-    # checked screened post
-    my $parentcomment = LJ::Comment->new( $u, jtalkid => $parpost->{jtalkid} );
-    return "<?h1 $ML{'Error'} h1?><?p $ML{'.error.noreply_screened'} p?>"
-        if $parpost->{'state'} eq "S" && !$parentcomment->visible_to( $remote );
+    my $parentcomment;
+    $parentcomment = LJ::Comment->new( $u, jtalkid => $parpost->{jtalkid} ) unless $toplevel;
+
+    # check for screened comment
+    if ( $parentcomment ) {
+        return "<?h1 $ML{'Error'} h1?><?p $ML{'.error.noreply_screened'} p?>"
+            if $parpost->{'state'} eq "S" && !$parentcomment->visible_to( $remote );
+    }
 
     return "<?h1 $ML{'Error'} h1?><?p $ML{'.error.noreply_deleted'} p?>"
         if $parpost->{'state'} eq "D";
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org