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:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
class RawBookmarksNoticeStream extends NoticeStream
|
||||
{
|
||||
protected $user_id;
|
||||
@@ -60,7 +62,7 @@ class RawBookmarksNoticeStream extends NoticeStream
|
||||
|
||||
class BookmarksNoticeStream extends ScopingNoticeStream
|
||||
{
|
||||
function __construct($user_id, $own, $profile = -1)
|
||||
function __construct($user_id, $own, Profile $scoped=null)
|
||||
{
|
||||
$stream = new RawBookmarksNoticeStream($user_id, $own);
|
||||
|
||||
@@ -70,11 +72,6 @@ class BookmarksNoticeStream extends ScopingNoticeStream
|
||||
$key = 'bookmark:ids_by_user:'.$user_id;
|
||||
}
|
||||
|
||||
if (is_int($profile) && $profile == -1) {
|
||||
$profile = Profile::current();
|
||||
}
|
||||
|
||||
parent::__construct(new CachingNoticeStream($stream, $key),
|
||||
$profile);
|
||||
parent::__construct(new CachingNoticeStream($stream, $key), $scoped);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user