afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-12-14 04:42 pm

[dw-free] style parameters no longer persist for expand links

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

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

Don't make expand url depend on permalink or thread url.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/LJ/S2.pm
  • cgi-bin/LJ/S2/EntryPage.pm
--------------------------------------------------------------------------------
diff -r 5f9962fc1e20 -r cc392d059a0e cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Mon Dec 14 16:39:17 2009 +0000
+++ b/cgi-bin/LJ/S2.pm	Mon Dec 14 16:42:03 2009 +0000
@@ -3311,7 +3311,7 @@ sub Comment__expand_link
     my $title = $opts->{title} ? " title='" . LJ::ehtml($opts->{title}) . "'" : "";
     my $class = $opts->{class} ? " class='" . LJ::ehtml($opts->{class}) . "'" : "";
 
-    return "<a href='$this->{permalink_url}'$title$class onClick=\"Expander.make(this,'$this->{permalink_url}','$this->{talkid}'); return false;\">$text</a>";
+    return "<a href='$this->{expand_url}'$title$class onClick=\"Expander.make(this,'$this->{expand_url}','$this->{talkid}'); return false;\">$text</a>";
 }
 
 sub Comment__print_expand_link
diff -r 5f9962fc1e20 -r cc392d059a0e cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm	Mon Dec 14 16:39:17 2009 +0000
+++ b/cgi-bin/LJ/S2/EntryPage.pm	Mon Dec 14 16:42:03 2009 +0000
@@ -274,8 +274,10 @@ sub EntryPage
             push @$link_keyseq, "watching_parent" if LJ::is_enabled('esn');
             unshift @$link_keyseq, "edit_comment" if LJ::is_enabled('edit_comments');
 
-            $s2com->{'thread_url'} = LJ::Talk::talkargs($permalink, "thread=$dtalkid", $style_arg) . LJ::Talk::comment_anchor( $dtalkid )
-                if @{$com->{children}};
+            # always populate expand url; let get_link sort out whether this link should be printed or not
+            # the value of expand_url is not directly exposed via s2. It is used by the get_link backend function
+            $s2com->{expand_url} = LJ::Talk::talkargs( $permalink, "thread=$dtalkid", $style_arg ) . LJ::Talk::comment_anchor( $dtalkid );
+            $s2com->{thread_url} = $s2com->{expand_url} if @{$com->{children}};
 
             # add the poster_ip metadata if remote user has
             # access to see it.
--------------------------------------------------------------------------------