git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit d7f96307 authored by Evan Prodromou's avatar Evan Prodromou

all filtering stream classes take an optional profile parameter

parent 1b00eb25
......@@ -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);
......
......@@ -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);
}
}
......
......@@ -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);
}
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
}
......
......@@ -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);
}
}
......
......@@ -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);
}
}
......
......@@ -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);
}
}
......
......@@ -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);
}
}
......
......@@ -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);
}
}
......
......@@ -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)));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment