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

Commit 792b6287 authored by mmn's avatar mmn

Require Profile for Profile->getLists

parent 3d66d960
......@@ -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)
......
......@@ -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()) {
......
......@@ -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;
}
......
......@@ -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();
......
......@@ -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()
......
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