]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
store our own userprofile for checking impossibility
authorEvan Prodromou <evan@status.net>
Wed, 21 Mar 2012 20:23:52 +0000 (16:23 -0400)
committerEvan Prodromou <evan@status.net>
Wed, 21 Mar 2012 20:23:52 +0000 (16:23 -0400)
lib/groupnoticestream.php
lib/profilenoticestream.php

index 849dfeaaf5b9f09c43d5cafe2a16d49b2ebe9005..c75d62141950f33a2be0bcd58a7d4bbe4f1c7835 100644 (file)
@@ -47,6 +47,7 @@ if (!defined('STATUSNET')) {
 class GroupNoticeStream extends ScopingNoticeStream
 {
     var $group;
+    var $userProfile;
 
     function __construct($group, $profile = -1)
     {
@@ -54,6 +55,7 @@ class GroupNoticeStream extends ScopingNoticeStream
             $profile = Profile::current();
         }
         $this->group = $group;
+        $this->userProfile = $profile;
 
         parent::__construct(new CachingNoticeStream(new RawGroupNoticeStream($group),
                                                     'user_group:notice_ids:' . $group->id),
@@ -81,7 +83,7 @@ class GroupNoticeStream extends ScopingNoticeStream
     function impossibleStream() 
     {
         if ($this->group->force_scope &&
-            (empty($this->profile) || !$this->profile->isMember($group))) {
+            (empty($this->userProfile) || !$this->userProfile->isMember($group))) {
             return true;
         }
 
index ba3387cf5ca7865036e667aa7d0e5db7971718fa..af59b0cc99b886bf6e0c501533cddb2b2fe7efd1 100644 (file)
@@ -48,6 +48,7 @@ if (!defined('STATUSNET')) {
 class ProfileNoticeStream extends ScopingNoticeStream
 {
     var $streamProfile;
+    var $userProfile;
 
     function __construct($profile, $userProfile = -1)
     {
@@ -55,6 +56,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
             $userProfile = Profile::current();
         }
         $this->streamProfile = $profile;
+        $this->userProfile   = $userProfile;
         parent::__construct(new CachingNoticeStream(new RawProfileNoticeStream($profile),
                                                     'profile:notice_ids:' . $profile->id),
                             $userProfile);
@@ -85,7 +87,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
         // If it's a private stream, and no user or not a subscriber
 
         if (!empty($user) && $user->private_stream && 
-            empty($this->profile) || !$this->profile->isSubscribed($this->streamProfile)) {
+            empty($this->userProfile) || !$this->userProfile->isSubscribed($this->streamProfile)) {
             return true;
         }
 
@@ -93,7 +95,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
 
         if (common_config('notice', 'hidespam')) {
             if ($this->streamProfile->hasRole(Profile_role::SILENCED) &&
-                (empty($this->profile) || !$this->profile->hasRole(Profile_role::MODERATOR))) {
+                (empty($this->userProfile) || !$this->userProfile->hasRole(Profile_role::MODERATOR))) {
                 return true;
             }
         }