We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 792b6287 authored by mattl's avatar mattl

Require Profile for Profile->getLists

parent 3d66d960
...@@ -185,7 +185,7 @@ class ApiListsAction extends ApiBareAuthAction ...@@ -185,7 +185,7 @@ class ApiListsAction extends ApiBareAuthAction
list($this->lists, list($this->lists,
$this->next_cursor, $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) function isReadOnly($args)
......
...@@ -68,7 +68,7 @@ class PeopletagautocompleteAction extends Action ...@@ -68,7 +68,7 @@ class PeopletagautocompleteAction extends Action
} }
$profile = $this->user->getProfile(); $profile = $this->user->getProfile();
$tags = $profile->getLists(common_current_user()); $tags = $profile->getLists($this->scoped);
$this->tags = array(); $this->tags = array();
while ($tags->fetch()) { while ($tags->fetch()) {
......
...@@ -116,7 +116,7 @@ class PeopletagsbyuserAction extends Action ...@@ -116,7 +116,7 @@ class PeopletagsbyuserAction extends Action
$user = common_current_user(); $user = common_current_user();
if ($this->arg('public')) { 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')) { } else if ($this->arg('private')) {
if (empty($user)) { if (empty($user)) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in 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 ...@@ -130,7 +130,7 @@ class PeopletagsbyuserAction extends Action
$this->clientError(_('You cannot view others\' private lists'), 403); $this->clientError(_('You cannot view others\' private lists'), 403);
} }
} else { } else {
$this->tags = $this->tagger->getLists(common_current_user(), $offset, $limit); $this->tags = $this->tagger->getLists($this->scoped, $offset, $limit);
} }
return true; return true;
} }
......
...@@ -381,7 +381,7 @@ class Profile extends Managed_DataObject ...@@ -381,7 +381,7 @@ class Profile extends Managed_DataObject
return false; 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(); $ids = array();
...@@ -421,9 +421,7 @@ class Profile extends Managed_DataObject ...@@ -421,9 +421,7 @@ class Profile extends Managed_DataObject
self::cacheSet($keypart, implode(',', $ids)); self::cacheSet($keypart, implode(',', $ids));
} }
$showPrivate = (($auth_user instanceof User || $showPrivate = $this->sameAs($scoped);
$auth_user instanceof Profile) &&
$auth_user->id === $this->id);
$lists = array(); $lists = array();
......
...@@ -49,9 +49,7 @@ class ListsNav extends MoreMenu ...@@ -49,9 +49,7 @@ class ListsNav extends MoreMenu
parent::__construct($out); parent::__construct($out);
$this->profile = $profile; $this->profile = $profile;
$user = common_current_user(); $this->lists = $profile->getLists(Profile::current());
$this->lists = $profile->getLists($user);
} }
function tag() 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