Require Profile for Profile->getLists

This commit is contained in:
Mikael Nordfeldth 2016-01-06 00:18:10 +01:00
parent 3d66d960a1
commit 792b62874e
5 changed files with 7 additions and 11 deletions

View File

@ -185,7 +185,7 @@ class ApiListsAction extends ApiBareAuthAction
list($this->lists,
$this->next_cursor,
$this->prev_cursor) = Profile_list::getAtCursor($fn, array($this->auth_user), $cursor, $count);
$this->prev_cursor) = Profile_list::getAtCursor($fn, array($this->scoped), $cursor, $count);
}
function isReadOnly($args)

View File

@ -68,7 +68,7 @@ class PeopletagautocompleteAction extends Action
}
$profile = $this->user->getProfile();
$tags = $profile->getLists(common_current_user());
$tags = $profile->getLists($this->scoped);
$this->tags = array();
while ($tags->fetch()) {

View File

@ -116,7 +116,7 @@ class PeopletagsbyuserAction extends Action
$user = common_current_user();
if ($this->arg('public')) {
$this->tags = $this->tagger->getLists(false, $offset, $limit);
$this->tags = $this->tagger->getLists(null, $offset, $limit);
} else if ($this->arg('private')) {
if (empty($user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
@ -130,7 +130,7 @@ class PeopletagsbyuserAction extends Action
$this->clientError(_('You cannot view others\' private lists'), 403);
}
} else {
$this->tags = $this->tagger->getLists(common_current_user(), $offset, $limit);
$this->tags = $this->tagger->getLists($this->scoped, $offset, $limit);
}
return true;
}

View File

@ -381,7 +381,7 @@ class Profile extends Managed_DataObject
return false;
}
function getLists($auth_user, $offset=0, $limit=null, $since_id=0, $max_id=0)
function getLists(Profile $scoped=null, $offset=0, $limit=null, $since_id=0, $max_id=0)
{
$ids = array();
@ -421,9 +421,7 @@ class Profile extends Managed_DataObject
self::cacheSet($keypart, implode(',', $ids));
}
$showPrivate = (($auth_user instanceof User ||
$auth_user instanceof Profile) &&
$auth_user->id === $this->id);
$showPrivate = $this->sameAs($scoped);
$lists = array();

View File

@ -49,9 +49,7 @@ class ListsNav extends MoreMenu
parent::__construct($out);
$this->profile = $profile;
$user = common_current_user();
$this->lists = $profile->getLists($user);
$this->lists = $profile->getLists(Profile::current());
}
function tag()