vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[ljcom] r12343: LJSUP-13023: Save settings of rating

Committer: vad
LJSUP-13023: Save settings of rating
U   trunk/cgi-bin/LJ/Widget/HomepageRU.pm
Modified: trunk/cgi-bin/LJ/Widget/HomepageRU.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/HomepageRU.pm	2012-07-25 07:21:32 UTC (rev 12342)
+++ trunk/cgi-bin/LJ/Widget/HomepageRU.pm	2012-07-25 09:06:02 UTC (rev 12343)
@@ -132,6 +132,10 @@
         $rating_show_custom = 1 unless defined $rating_show_custom;
         $rating_show_custom = ( $rating_show_custom ? 1 : 0 );
 
+        ## rating_top_journals_sort cookie specifies ratings sort order and usually is set or changed by JavaScript,
+        ## in case JS is disabled in browser or it does not support JS, set the cookie by Set-Cookie response header.
+        my $set_sort_cookie = 0;
+
         if (defined $GET->{'rating'}) {
             my %get_rating = map { lc($_) => 1 } split /\s+/, $GET->{'rating'};
 
@@ -144,9 +148,11 @@
 
             if ($get_rating{'custom'}) {
                 $rating_show_custom = 1;
+                $set_sort_cookie    = 1;
             }
             elsif ($get_rating{'all'}) {
                 $rating_show_custom = 0;
+                $set_sort_cookie    = 1;
             }
 
             if ($get_rating{'authority'}) {
@@ -194,7 +200,7 @@
         );
 
         LJ::Request->set_cookie('rating_show_custom' => $rating_show_custom, 'expires' => time + 60*60*24*180);
-        LJ::Request->set_cookie('rating_top_journals_sort' => $output->{'sort'}, 'expires' => time + 60*60*24*180);
+        LJ::Request->set_cookie('rating_top_journals_sort' => $output->{'sort'}, 'expires' => time + 60*60*24*180) if $set_sort_cookie;
     }
 
     ## Widget SettingWindow

Tags: ljcom, pm, vad, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments