Consistent behaviour for ScopingNoticeStream $scoped

We don't guess the current profile anymore if the value of the profile === -1

Also sets $this->scoped for all ScopingNoticeStream inheritors, which just
like in an Action can be null if we're not scoped in any way (logged in).
This commit is contained in:
Mikael Nordfeldth
2016-03-01 14:51:47 +01:00
parent 7862b853bf
commit 63c087a255
38 changed files with 151 additions and 239 deletions

View File

@@ -152,16 +152,22 @@ class Fave extends Managed_DataObject
return $result;
}
// FIXME: Instead of $own, send the scoped Profile so we can pass it along directly to FaveNoticeStream
// and preferrably we should get a Profile instead of $user_id
static function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0)
{
$stream = new FaveNoticeStream($user_id, $own);
$target = Profile::getByID($user_id);
$stream = new FaveNoticeStream($target, ($own ? $target : null));
return $stream->getNotices($offset, $limit, $since_id, $max_id);
}
// FIXME: Instead of $own, send the scoped Profile so we can pass it along directly to FaveNoticeStream
// and preferrably we should get a Profile instead of $user_id
function idStream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0)
{
$stream = new FaveNoticeStream($user_id, $own);
$target = Profile::getByID($user_id);
$stream = new FaveNoticeStream($target, ($own ? $target : null));
return $stream->getNoticeIds($offset, $limit, $since_id, $max_id);
}