mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-03-15 06:24 am

[dw-free] Locked community entries do not show up on the daypage/monthpage

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

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

Fix S2 DayPage/MonthPage to work with new community membership model.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/LJ/S2/DayPage.pm
  • cgi-bin/LJ/S2/MonthPage.pm
--------------------------------------------------------------------------------
diff -r da555ff59771 -r 87c024c4d0e8 cgi-bin/LJ/S2/DayPage.pm
--- a/cgi-bin/LJ/S2/DayPage.pm	Sun Mar 15 14:11:22 2009 +0800
+++ b/cgi-bin/LJ/S2/DayPage.pm	Sun Mar 15 06:24:30 2009 +0000
@@ -59,7 +59,17 @@ sub DayPage
         if ($remote->{'userid'} == $u->{'userid'} || $viewall) {
             $secwhere = "";   # see everything
         } elsif ($remote->{'journaltype'} eq 'P') {
-            my $gmask = $u->trustmask( $remote );
+
+            # if we're viewing a community, we intuit the security mask from the membership
+            my $gmask = 0;
+            if ( $u->is_community ) {
+                $gmask = 1
+                    if $remote->member_of( $u );
+
+            } else {
+                $gmask = $u->trustmask( $remote );
+            }
+
             $secwhere = "AND (security='public' OR (security='usemask' AND allowmask & $gmask))"
                 if $gmask;
         }
diff -r da555ff59771 -r 87c024c4d0e8 cgi-bin/LJ/S2/MonthPage.pm
--- a/cgi-bin/LJ/S2/MonthPage.pm	Sun Mar 15 14:11:22 2009 +0800
+++ b/cgi-bin/LJ/S2/MonthPage.pm	Sun Mar 15 06:24:30 2009 +0000
@@ -59,7 +59,17 @@ sub MonthPage
         if ($remote->{'userid'} == $u->{'userid'} || $viewall) {
             $secwhere = "";   # see everything
         } elsif ($remote->{'journaltype'} eq 'P') {
-            my $gmask = $u->trustmask( $remote );
+
+            # if we're viewing a community, we intuit the security mask from the membership
+            my $gmask = 0;
+            if ( $u->is_community ) {
+                $gmask = 1
+                    if $remote->member_of( $u );
+
+            } else {
+                $gmask = $u->trustmask( $remote );
+            }
+
             $secwhere = "AND (l.security='public' OR (l.security='usemask' AND l.allowmask & $gmask))"
                 if $gmask;
         }
--------------------------------------------------------------------------------