kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2010-09-11 02:11 pm

[dw-free] Unbreak editing comments with deleted parents

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

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

Ignore the parent comment when editing a reply to a deleted comment.

Codemerge from LJ; adapted for Dreamwidth by [personal profile] yvi.

Files modified:
  • cgi-bin/LJ/S2/ReplyPage.pm
  • htdocs/talkpost.bml
--------------------------------------------------------------------------------
diff -r 518b72120000 -r b742d4633e8c cgi-bin/LJ/S2/ReplyPage.pm
--- a/cgi-bin/LJ/S2/ReplyPage.pm	Thu Sep 09 19:24:25 2010 +0800
+++ b/cgi-bin/LJ/S2/ReplyPage.pm	Sat Sep 11 09:10:59 2010 -0500
@@ -109,6 +109,8 @@ sub ReplyPage
         }
 
         $parpost = $comment->parent;
+        # for comments where the parent comment is deleted, we pretend the parent comment doesn't exist so the user can edit
+        $parpost = undef if $parpost && $parpost->is_deleted;
         $replytoid = $parpost ? $comment->parent->dtalkid : 0;
 
         $comment_values{edit} = $editid;
diff -r 518b72120000 -r b742d4633e8c htdocs/talkpost.bml
--- a/htdocs/talkpost.bml	Thu Sep 09 19:24:25 2010 +0800
+++ b/htdocs/talkpost.bml	Sat Sep 11 09:10:59 2010 -0500
@@ -46,6 +46,8 @@ body<=
         return $errtxt unless $comment->remote_can_edit(\$errtxt);
 
         my $parent = $comment->parent;
+        # for comments where the parent comment is deleted, we pretend the parent comment doesn't exist so the user can edit
+        $parent = undef if $parent && $parent->is_deleted;
         $FORM{replyto} = $parent ? $comment->parent->dtalkid : 0;
 
         $FORM{subject} = $comment->subject_orig;
@@ -88,7 +90,7 @@ body<=
     my $parpost;
     my $reply;
 
-    if ($init->{'replyto'} || ($editid && $comment->parenttalkid))
+    if ( $init->{replyto} )
     {
         my $qparentid = $init->{'replyto'};
 
--------------------------------------------------------------------------------