Merge branch 'group-members-pending' into 'nightly'

Fix "pending members" group list

Related to #104 

See merge request !64
This commit is contained in:
mmn 2015-12-14 20:47:47 +00:00
commit d5d8068632

View File

@ -220,24 +220,19 @@ class User_group extends Managed_DataObject
*/
function getRequests($offset=0, $limit=null)
{
$qry =
'SELECT profile.* ' .
'FROM profile JOIN group_join_queue '.
'ON profile.id = group_join_queue.profile_id ' .
'WHERE group_join_queue.group_id = %d ' .
'ORDER BY group_join_queue.created DESC ';
if ($limit != null) {
if (common_config('db','type') == 'pgsql') {
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
} else {
$qry .= ' LIMIT ' . $offset . ', ' . $limit;
}
}
$rq = new Group_join_queue();
$rq->group_id = $this->id;
$members = new Profile();
$members->query(sprintf($qry, $this->id));
$members->joinAdd(['id', $rq, 'profile_id']);
if ($limit != null) {
$members->limit($offset, $limit);
}
$members->find();
return $members;
}