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

[dw-free] Remember ?style=mine when moving between entries in a journal

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

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

Remember ?style=* parameters when going to next/previous entries.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/S2.pm
  • cgi-bin/LJ/Talk.pm
  • htdocs/go.bml
--------------------------------------------------------------------------------
diff -r df0e44320be3 -r 785bf2db2878 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Wed Nov 17 15:25:38 2010 +0800
+++ b/cgi-bin/LJ/S2.pm	Wed Nov 17 16:46:40 2010 +0800
@@ -3763,12 +3763,20 @@ sub _Entry__get_link
                             LJ::S2::Image_std( 'memadd' ) );
     }
     if ($key eq "nav_prev") {
-        return LJ::S2::Link("$LJ::SITEROOT/go?journal=$journal&itemid=$this->{'itemid'}&dir=prev",
+        return LJ::S2::Link( LJ::create_url( "/go", host => $LJ::DOMAIN_WEB, viewing_style => 1, args => {
+                                    journal => $journal,
+                                    itemid => $this->{itemid},
+                                    dir => "prev",
+                                } ),
                             $ctx->[S2::PROPS]->{"text_entry_prev"},
                             LJ::S2::Image_std( 'prev_entry' ) );
     }
     if ($key eq "nav_next") {
-        return LJ::S2::Link("$LJ::SITEROOT/go?journal=$journal&itemid=$this->{'itemid'}&dir=next",
+        return LJ::S2::Link( LJ::create_url( "/go", host => $LJ::DOMAIN_WEB, viewing_style => 1, args => {
+                                    journal => $journal,
+                                    itemid => $this->{itemid},
+                                    dir => "next",
+                                } ),
                             $ctx->[S2::PROPS]->{"text_entry_next"},
                             LJ::S2::Image_std( 'next_entry' ) );
     }
diff -r df0e44320be3 -r 785bf2db2878 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm	Wed Nov 17 15:25:38 2010 +0800
+++ b/cgi-bin/LJ/Talk.pm	Wed Nov 17 16:46:40 2010 +0800
@@ -126,8 +126,13 @@ sub link_bar
 
     # << Previous
     my @linkele;
-    push @linkele, $mlink->("$LJ::SITEROOT/go?${jargent}itemid=$itemid&amp;dir=prev", "prev_entry");
-    $$headref .= "<link href='$LJ::SITEROOT/go?${jargent}itemid=$itemid&amp;dir=prev' rel='Previous' />\n";
+    my $prevlink =  LJ::create_url( "/go", host => $LJ::DOMAIN_WEB, viewing_style => 1, args => {
+                                    journal => $u->user,
+                                    itemid => $itemid,
+                                    dir => "prev",
+                                } );
+    push @linkele, $mlink->( $prevlink, "prev_entry" );
+    $$headref .= "<link href='$prevlink' rel='Previous' />\n";
 
     # memories
     if ( LJ::is_enabled('memories') ) {
@@ -163,8 +168,13 @@ sub link_bar
 
 
     ## >>> Next
-    push @linkele, $mlink->("$LJ::SITEROOT/go?${jargent}itemid=$itemid&amp;dir=next", "next_entry");
-    $$headref .= "<link href='$LJ::SITEROOT/go?${jargent}itemid=$itemid&amp;dir=next' rel='Next' />\n";
+    my $nextlink =  LJ::create_url( "/go", host => $LJ::DOMAIN_WEB, viewing_style => 1, args => {
+                                    journal => $u->user,
+                                    itemid => $itemid,
+                                    dir => "next",
+                                } );
+    push @linkele, $mlink->("$nextlink", "next_entry");
+    $$headref .= "<link href='$nextlink' rel='Next' />\n";
 
     my $ret;
     if ( @linkele ) {
diff -r df0e44320be3 -r 785bf2db2878 htdocs/go.bml
--- a/htdocs/go.bml	Wed Nov 17 15:25:38 2010 +0800
+++ b/htdocs/go.bml	Wed Nov 17 16:46:40 2010 +0800
@@ -78,7 +78,10 @@ _c?>
     $body .= "<p>" . BML::ml( '.link.to.journal', { journal => $u->ljuser_display } ) . "</p>";
 
      if ( $jumpid ) {
-         return BML::redirect( $u->journal_base . "/$jumpid.html" );
+         my $host = $u->journal_base;
+         $host =~ s#^(?:https?://)##;
+
+         return BML::redirect( LJ::create_url( "/$jumpid.html", host => $host, viewing_style => 1 ) );
      }
  }
 
--------------------------------------------------------------------------------

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