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:27 am

[dw-free] add link back to comment & parent on ?replyto=foo in sitescheme

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

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

Add links back to reply, thread, parent, thread from start.

Patch by [personal profile] yvi.

Files modified:
  • cgi-bin/LJ/Comment.pm
  • htdocs/talkpost.bml
--------------------------------------------------------------------------------
diff -r 1537a89bbc5c -r ad465478da5a cgi-bin/LJ/Comment.pm
--- a/cgi-bin/LJ/Comment.pm	Thu Apr 29 01:26:27 2010 -0700
+++ b/cgi-bin/LJ/Comment.pm	Thu Apr 29 01:31:55 2010 -0700
@@ -263,12 +263,12 @@ sub reply_url {
 }
 
 sub parent_url {
-    my $self    = shift;
+    my ( $self, $url_args ) = @_;
 
     my $parent  = $self->parent;
 
     return undef unless $parent;
-    return $parent->url;
+    return $parent->url( $url_args );
 }
 
 sub unscreen_url {
diff -r 1537a89bbc5c -r ad465478da5a htdocs/talkpost.bml
--- a/htdocs/talkpost.bml	Thu Apr 29 01:26:27 2010 -0700
+++ b/htdocs/talkpost.bml	Thu Apr 29 01:31:55 2010 -0700
@@ -369,6 +369,28 @@ body<=
     $ret .= $event;
     $ret .= "</div>";
 
+    # links to reply, thread from start, parent comment, and thread
+    if ( $parentcomment ) {
+        $ret .= "<br /><div id='comment-interaction-links'>";
+
+        my $reply_url = LJ::Talk::talkargs( $parentcomment->reply_url, LJ::viewing_style_args( %GET ) );
+        $ret .= "(<a href=". $reply_url . ">" . $ML{'talk.replytothis'} . "</a>)";
+
+        # only link to thread from start / parent comment if this isn't a top-level comment
+        if ( $parentcomment->parent ) {
+            my $threadstart_url = $parentcomment->threadroot_url( LJ::viewing_style_args( %GET ) );
+            $ret .= " (<a href=". $threadstart_url . ">" . $ML{'talk.threadrootlink'} . "</a>)";
+
+            my $parent_url = $parentcomment->parent_url( LJ::viewing_style_args( %GET ) );
+            $ret .= " (<a href=". $parent_url . ">" . $ML{'talk.parentlink'} . "</a>)";
+        }
+
+        my $thread_url = $parentcomment->url( LJ::viewing_style_args( %GET ) );
+        $ret .= " (<a href=". $thread_url . ">" . $ML{'talk.threadlink'} . "</a>)";
+    }
+
+    $ret .= "</div>";
+
     $ret .= "<br clear='both' /><hr size='2' align='center' />";
 
     my $qotd = 0;
--------------------------------------------------------------------------------
mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)

[staff profile] mark 2010-05-01 05:58 pm (UTC)(link)
The various urls in this patch need to be in quotes. Right now they are interpolated with nothing around them like <a href=http://.../>. Needs quotes around the attribute.
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2010-05-13 12:01 am (UTC)(link)