]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
all filtering stream classes take an optional profile parameter
authorEvan Prodromou <evan@status.net>
Mon, 11 Apr 2011 16:32:35 +0000 (12:32 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 11 Apr 2011 16:32:35 +0000 (12:32 -0400)
12 files changed:
lib/conversationnoticestream.php
lib/favenoticestream.php
lib/filenoticestream.php
lib/groupnoticestream.php
lib/inboxnoticestream.php
lib/peopletagnoticestream.php
lib/profilenoticestream.php
lib/repeatedbymenoticestream.php
lib/repeatsofmenoticestream.php
lib/replynoticestream.php
lib/taggedprofilenoticestream.php
lib/tagnoticestream.php

index 56850fe98248dc03b1ed12704b7adb34ff970c61..66075db84f436a62c095174f0036b8231fddf4a5 100644 (file)
@@ -46,8 +46,12 @@ if (!defined('STATUSNET')) {
  */
 class ConversationNoticeStream extends ScopingNoticeStream
 {
-    function __construct($id, $profile = null)
+    function __construct($id, $profile = -1)
     {
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
+
         parent::__construct(new CachingNoticeStream(new RawConversationNoticeStream($id),
                                                     'notice:conversation_ids:'.$id),
                             $profile);
index b586a94d1762e7f2cdd45e184c85943030b0fe89..6527e5441e37cc8dd5c11acb9bd1e6f93b1c8c4c 100644 (file)
@@ -46,7 +46,7 @@ if (!defined('STATUSNET')) {
  */
 class FaveNoticeStream extends ScopingNoticeStream
 {
-    function __construct($user_id, $own)
+    function __construct($user_id, $own, $profile = -1)
     {
         $stream = new RawFaveNoticeStream($user_id, $own);
         if ($own) {
@@ -54,7 +54,11 @@ class FaveNoticeStream extends ScopingNoticeStream
         } else {
             $key = 'fave:ids_by_user:'.$user_id;
         }
-        parent::__construct(new CachingNoticeStream($stream, $key));
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
+        parent::__construct(new CachingNoticeStream($stream, $key),
+                            $profile);
     }
 }
 
index 2b5e53eaf798a142fc777d70b428e19a3b343378..fba6183fc22c98d84c6d735731cd91ce98952c7b 100644 (file)
@@ -36,10 +36,14 @@ if (!defined('STATUSNET')) {
 
 class FileNoticeStream extends ScopingNoticeStream
 {
-    function __construct($file)
+    function __construct($file, $profile = -1)
     {
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
         parent::__construct(new CachingNoticeStream(new RawFileNoticeStream($file),
-                                                    'file:notice-ids:'.$this->url));
+                                                    'file:notice-ids:'.$this->url),
+                            $profile);
     }
 }
 
index 930afe608108027a91d9c1c92b63d631585106fc..26784458e0ea1c7a7590cd068593098bcc13dab5 100644 (file)
@@ -46,8 +46,11 @@ if (!defined('STATUSNET')) {
  */
 class GroupNoticeStream extends ScopingNoticeStream
 {
-    function __construct($group, $profile = null)
+    function __construct($group, $profile = -1)
     {
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
         parent::__construct(new CachingNoticeStream(new RawGroupNoticeStream($group),
                                                     'user_group:notice_ids:' . $group->id),
                             $profile);
index 09c3edb281d76420ba93e9044002f4669447939b..3250351d17aea2fc865a94d1f5b4ee2822df7ccb 100644 (file)
@@ -51,8 +51,11 @@ class InboxNoticeStream extends ScopingNoticeStream
      *
      * @param User $user User to get a stream for
      */
-    function __construct($user, $profile = null)
+    function __construct($user, $profile = -1)
     {
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
         // Note: we don't use CachingNoticeStream since RawInboxNoticeStream
         // uses Inbox::staticGet(), which is cached.
         parent::__construct(new RawInboxNoticeStream($user), $profile);
index 34e7443da5e0e45d16abb86668770832d2f5619a..5eed25412fc38c10b46756e1ffdbfa10496fe4c9 100644 (file)
@@ -47,10 +47,14 @@ if (!defined('STATUSNET')) {
  */
 class PeopletagNoticeStream extends ScopingNoticeStream
 {
-    function __construct($plist)
+    function __construct($plist, $profile = -1)
     {
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
         parent::__construct(new CachingNoticeStream(new RawPeopletagNoticeStream($plist),
-                                                    'profile_tag:notice_ids:' . $plist->id));
+                                                    'profile_tag:notice_ids:' . $plist->id),
+                            $profile);
     }
 }
 
index 7ea653f8c8c2a1bcc31bfabc6ad033c5f643c2d0..64cd31abc48d64f5d83276c5b2ea8db95b8d7d9b 100644 (file)
@@ -47,10 +47,14 @@ if (!defined('STATUSNET')) {
 
 class ProfileNoticeStream extends ScopingNoticeStream
 {
-    function __construct($profile)
+    function __construct($profile, $userProfile = -1)
     {
+        if (is_int($userProfile) && $userProfile == -1) {
+            $userProfile = Profile::current();
+        }
         parent::__construct(new CachingNoticeStream(new RawProfileNoticeStream($profile),
-                                                    'profile:notice_ids:' . $profile->id));
+                                                    'profile:notice_ids:' . $profile->id),
+                            $userProfile);
     }
 }
 
index 98c1583d6a596481a252a9ef7d1ad14b32358296..4e3e34162b15acb33feee43a98937ea6683aae98 100644 (file)
@@ -47,10 +47,14 @@ if (!defined('STATUSNET')) {
 
 class RepeatedByMeNoticeStream extends ScopingNoticeStream
 {
-    function __construct($user)
+    function __construct($user, $profile = -1)
     {
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
         parent::__construct(new CachingNoticeStream(new RawRepeatedByMeNoticeStream($user),
-                                                    'user:repeated_by_me:'.$user->id));
+                                                    'user:repeated_by_me:'.$user->id),
+                            $profile);
     }
 }
 
index f51fc9e4472d49b1d041f01cbeae762e60875497..ec80d8431447c10fadb929728ecc4f04055fa908 100644 (file)
@@ -47,10 +47,14 @@ if (!defined('STATUSNET')) {
 
 class RepeatsOfMeNoticeStream extends ScopingNoticeStream
 {
-    function __construct($user)
+    function __construct($user, $profile=-1)
     {
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
         parent::__construct(new CachingNoticeStream(new RawRepeatsOfMeNoticeStream($user),
-                                                    'user:repeats_of_me:'.$user->id));
+                                                    'user:repeats_of_me:'.$user->id),
+                            $profile);
     }
 }
 
index 9de8d4efaf9c49ca62b17e48e819537c2f7b4dba..ec13ff9a67f6906bd80d6e7149f10832906031da 100644 (file)
@@ -47,10 +47,14 @@ if (!defined('STATUSNET')) {
 
 class ReplyNoticeStream extends ScopingNoticeStream
 {
-    function __construct($userId)
+    function __construct($userId, $profile=-1)
     {
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
         parent::__construct(new CachingNoticeStream(new RawReplyNoticeStream($userId),
-                                                    'reply:stream:' . $userId));
+                                                    'reply:stream:' . $userId),
+                            $profile);
     }
 }
 
index 83c304ed8ffedce35d2797e9f2b53014b56b35f1..9998b7d7699a8550c5c5adc959bacda28d5e19f7 100644 (file)
@@ -47,10 +47,14 @@ if (!defined('STATUSNET')) {
 
 class TaggedProfileNoticeStream extends ScopingNoticeStream
 {
-    function __construct($profile, $tag)
+    function __construct($profile, $tag, $userProfile)
     {
+        if (is_int($userProfile) && $userProfile == -1) {
+            $userProfile = Profile::current();
+        }
         parent::__construct(new CachingNoticeStream(new RawTaggedProfileNoticeStream($profile, $tag),
-                                                    'profile:notice_ids_tagged:'.$profile->id.':'.Cache::keyize($tag)));
+                                                    'profile:notice_ids_tagged:'.$profile->id.':'.Cache::keyize($tag)),
+                            $userProfile);
     }
 }
 
index 1dcf9f14bb9b4f12e951daad8462783bfafc7f7b..567f04b7e45c56ba8866da522e11a9e4656b1f78 100644 (file)
@@ -47,8 +47,11 @@ if (!defined('STATUSNET')) {
 
 class TagNoticeStream extends ScopingNoticeStream
 {
-    function __construct($tag)
+    function __construct($tag, $profile = -1)
     {
+        if (is_int($profile) && $profile == -1) {
+            $profile = Profile::current();
+        }
         parent::__construct(new CachingNoticeStream(new RawTagNoticeStream($tag),
                                                     'notice_tag:notice_ids:' . Cache::keyize($tag)));
     }