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:38 am

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

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

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

Update get_daycounts to work with community membership changes.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/LJ/User.pm
--------------------------------------------------------------------------------
diff -r 87c024c4d0e8 -r 9dda78055ea0 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Sun Mar 15 06:24:30 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Sun Mar 15 06:38:24 2009 +0000
@@ -8130,8 +8130,18 @@ sub get_daycounts
             $secwhere = "";   # see everything
             $memkind = 'a'; # all
         } elsif ($remote->{'journaltype'} eq 'P') {
-            my $gmask = $u->trustmask( $remote );
-            if ($gmask) {
+
+            # 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 );
+            }
+
+            if ( $gmask ) {
                 $secwhere = "AND (security='public' OR (security='usemask' AND allowmask & $gmask))";
                 $memkind = 'g' . $gmask; # friends case: allowmask == gmask == 1
             }
--------------------------------------------------------------------------------