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

Commit 3d66d960 authored by mattl's avatar mattl

Require Profile for Profile->getOtherTags

parent 8ad6b880
...@@ -115,11 +115,10 @@ class ApiListMembershipsAction extends ApiBareAuthAction ...@@ -115,11 +115,10 @@ class ApiListMembershipsAction extends ApiBareAuthAction
function getLists() function getLists()
{ {
$profile = $this->target; $fn = array($this->target, 'getOtherTags');
$fn = array($profile, 'getOtherTags');
# 20 lists # 20 lists
list($this->lists, $this->next_cursor, $this->prev_cursor) = list($this->lists, $this->next_cursor, $this->prev_cursor) =
Profile_list::getAtCursor($fn, array($this->auth_user), $this->cursor, 20); Profile_list::getAtCursor($fn, array($this->scoped), $this->cursor, 20);
} }
} }
...@@ -126,7 +126,7 @@ class PeopletagsforuserAction extends Action ...@@ -126,7 +126,7 @@ class PeopletagsforuserAction extends Action
$offset = ($this->page-1) * PEOPLETAGS_PER_PAGE; $offset = ($this->page-1) * PEOPLETAGS_PER_PAGE;
$limit = PEOPLETAGS_PER_PAGE + 1; $limit = PEOPLETAGS_PER_PAGE + 1;
$ptags = $this->tagged->getOtherTags(common_current_user(), $offset, $limit); $ptags = $this->tagged->getOtherTags($this->scoped, $offset, $limit);
$pl = new PeopletagList($ptags, $this); $pl = new PeopletagList($ptags, $this);
$cnt = $pl->show(); $cnt = $pl->show();
......
...@@ -446,7 +446,7 @@ class Profile extends Managed_DataObject ...@@ -446,7 +446,7 @@ class Profile extends Managed_DataObject
/** /**
* Get tags that other people put on this profile, in reverse-chron order * Get tags that other people put on this profile, in reverse-chron order
* *
* @param (Profile|User) $auth_user Authorized user (used for privacy) * @param Profile $scoped User we are requesting as
* @param int $offset Offset from latest * @param int $offset Offset from latest
* @param int $limit Max number to get * @param int $limit Max number to get
* @param datetime $since_id max date * @param datetime $since_id max date
...@@ -455,7 +455,7 @@ class Profile extends Managed_DataObject ...@@ -455,7 +455,7 @@ class Profile extends Managed_DataObject
* @return Profile_list resulting lists * @return Profile_list resulting lists
*/ */
function getOtherTags($auth_user=null, $offset=0, $limit=null, $since_id=0, $max_id=0) function getOtherTags(Profile $scoped=null, $offset=0, $limit=null, $since_id=0, $max_id=0)
{ {
$list = new Profile_list(); $list = new Profile_list();
...@@ -467,11 +467,11 @@ class Profile extends Managed_DataObject ...@@ -467,11 +467,11 @@ class Profile extends Managed_DataObject
$this->id); $this->id);
if ($auth_user instanceof User || $auth_user instanceof Profile) { if (!is_null($scoped)) {
$qry .= sprintf('AND ( ( profile_list.private = false ) ' . $qry .= sprintf('AND ( ( profile_list.private = false ) ' .
'OR ( profile_list.tagger = %d AND ' . 'OR ( profile_list.tagger = %d AND ' .
'profile_list.private = true ) )', 'profile_list.private = true ) )',
$auth_user->id); $scoped->getID());
} else { } else {
$qry .= 'AND profile_list.private = 0 '; $qry .= 'AND profile_list.private = 0 ';
} }
......
...@@ -54,8 +54,7 @@ class PeopletagsForUserSection extends PeopletagSection ...@@ -54,8 +54,7 @@ class PeopletagsForUserSection extends PeopletagSection
$limit = PEOPLETAGS_PER_SECTION+1; $limit = PEOPLETAGS_PER_SECTION+1;
$offset = 0; $offset = 0;
$auth_user = common_current_user(); $ptags = $this->profile->getOtherTags(Profile::current(), $offset, $limit);
$ptags = $this->profile->getOtherTags($auth_user, $offset, $limit);
return $ptags; return $ptags;
} }
......
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