]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/peopletagnoticestream.php
Merge branch 'nightly' into 'nightly'
[quix0rs-gnu-social.git] / lib / peopletagnoticestream.php
index f90255b111c195dc654c307226373a87bbf3f340..cc453bf1f81aeed2fe5d3bc0f48066988fb8f1af 100644 (file)
@@ -3,7 +3,7 @@
  * StatusNet - the distributed open-source microblogging tool
  * Copyright (C) 2011, StatusNet, Inc.
  *
- * Stream of notices for a people tag
+ * Stream of notices for a list
  *
  * PHP version 5
  *
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    // This check helps protect against security problems;
-    // your code file can't be executed directly from the web.
-    exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
- * Stream of notices for a people tag
+ * Stream of notices for a list
  *
  * @category  Stream
  * @package   StatusNet
@@ -47,19 +43,16 @@ if (!defined('STATUSNET')) {
  */
 class PeopletagNoticeStream extends ScopingNoticeStream
 {
-    function __construct($plist, $profile = -1)
+    function __construct($plist, Profile $scoped=null)
     {
-        if (is_int($profile) && $profile == -1) {
-            $profile = Profile::current();
-        }
         parent::__construct(new CachingNoticeStream(new RawPeopletagNoticeStream($plist),
                                                     'profile_list:notice_ids:' . $plist->id),
-                            $profile);
+                            $scoped);
     }
 }
 
 /**
- * Stream of notices for a people tag
+ * Stream of notices for a list
  *
  * @category  Stream
  * @package   StatusNet
@@ -99,7 +92,9 @@ class RawPeopletagNoticeStream extends NoticeStream
         $ptag = new Profile_tag();
         $ptag->tag    = $this->profile_list->tag;
         $ptag->tagger = $this->profile_list->tagger;
-        $notice->joinAdd($ptag);
+        $notice->joinAdd(array('profile_id', 'profile_tag:tagged'));
+        $notice->whereAdd('profile_tag.tagger = ' . $this->profile_list->tagger);
+        $notice->whereAdd(sprintf('profile_tag.tag = "%s"', $this->profile_list->tag));
 
         if ($since_id != 0) {
             $notice->whereAdd('notice.id > ' . $since_id);