kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2010-06-29 09:00 pm

[dw-free] function FriendsPage::view_title() doesn't work properly

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

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

Update title of page when viewing by filter or access level.

Patch by [personal profile] yvi.

Files modified:
  • bin/upgrading/s2layers/core2.s2
  • cgi-bin/LJ/S2/FriendsPage.pm
  • cgi-bin/LJ/S2/RecentPage.pm
--------------------------------------------------------------------------------
diff -r c1e5d7213dfc -r 8a4cea92356e bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2	Tue Jun 29 14:37:20 2010 -0500
+++ b/bin/upgrading/s2layers/core2.s2	Tue Jun 29 15:59:52 2010 -0500
@@ -690,6 +690,9 @@ class RecentPage extends Page
     var string filter_name
     "The name of the filter in effect, if it has a name. This is only used when [member[RecentPage.filter_active]] is true.";
 
+    var bool filter_tags
+    "If true, the page is being filtered to only entries tagged with a specific tag. This is only used when [member[RecentPage.filter_active]] is true.";
+
 }
 
 class FriendsPage extends RecentPage
@@ -3319,7 +3322,11 @@ function Page::view_title() [notags] : s
 }
 function RecentPage::view_title() : string {
     if ($.filter_active) {
-        return $*text_view_recent_tagged + $.filter_name;
+        if ($.filter_tags) {
+            return $*text_view_recent_tagged + $.filter_name;
+        } else {
+            return "(" + $.filter_name + ")";
+        }
     }
     else {
         return $*text_view_recent;
diff -r c1e5d7213dfc -r 8a4cea92356e cgi-bin/LJ/S2/FriendsPage.pm
--- a/cgi-bin/LJ/S2/FriendsPage.pm	Tue Jun 29 14:37:20 2010 -0500
+++ b/cgi-bin/LJ/S2/FriendsPage.pm	Tue Jun 29 15:59:52 2010 -0500
@@ -125,9 +125,12 @@ sub FriendsPage
     my $cf = $u->content_filters( name => $group_name || "Default" ) ||
              $u->content_filters( name => "Default View" );
 
+    my $filter;
+    if ( $opts->{securityfilter} ) {
+            $p->{filter_active} = 1;
+            $p->{filter_name} = $opts->{securityfilter};
+    } else {
     # but we can't just use a filter, we have to make sure the person is allowed to
-    my $filter;
-    unless ( $opts->{securityfilter} ) {
         if ( ( $get->{filter} ne "0" ) && $cf && ( $u->equals( $remote ) || $cf->public ) ) {
             $filter = $cf;
 
diff -r c1e5d7213dfc -r 8a4cea92356e cgi-bin/LJ/S2/RecentPage.pm
--- a/cgi-bin/LJ/S2/RecentPage.pm	Tue Jun 29 14:37:20 2010 -0500
+++ b/cgi-bin/LJ/S2/RecentPage.pm	Tue Jun 29 15:59:52 2010 -0500
@@ -29,11 +29,12 @@ sub RecentPage
     $opts->{'addfeeds'} = 1;
 
     my $p = Page($u, $opts);
-    $p->{'_type'} = "RecentPage";
-    $p->{'view'} = "recent";
-    $p->{'entries'} = [];
-    $p->{'filter_active'} = 0;
-    $p->{'filter_name'} = "";
+    $p->{_type} = "RecentPage";
+    $p->{view} = "recent";
+    $p->{entries} = [];
+    $p->{filter_active} = 0;
+    $p->{filter_name} = "";
+    $p->{filter_tags} = 0;
 
     # Link to the friends page as a "group", for use with OpenID "Group Membership Protocol"
     {
@@ -63,9 +64,15 @@ sub RecentPage
     $remote->preload_props( "opt_nctalklinks", "opt_cut_disable_journal") if $remote;
 
     if ( $opts->{tags} ) {
-        $p->{'filter_active'} = 1;
-        $p->{'filter_name'} = join(", ", @{$opts->{tags}});
+        $p->{filter_active} = 1;
+        $p->{filter_name} = join(", ", @{$opts->{tags}});
+        $p->{filter_tags} = 1;
     }
+
+    if ( $opts->{securityfilter} ) {
+        $p->{filter_active} = 1;
+        $p->{filter_name} = $opts->{securityfilter};
+    } 
 
     my $get = $opts->{'getargs'};
 
--------------------------------------------------------------------------------