Fix people sorting by "Default" when filter "Group" is selected (#5111)

This commit is contained in:
Yuriy Bakhtin 2021-06-09 11:23:59 +03:00 committed by GitHub
parent 5b02fff527
commit 17ffa49f78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,8 +211,8 @@ class PeopleQuery extends ActiveQueryUser
if (empty($defaultSortingGroupId)) {
$this->addOrderBy('last_login DESC');
} else {
$this->leftJoin('group_user', 'group_user.user_id = user.id AND group_user.group_id = :defaultGroupId', [':defaultGroupId' => $defaultSortingGroupId]);
$this->addOrderBy('group_user.group_id DESC, last_login DESC');
$this->leftJoin('group_user AS top_group_sorting', 'top_group_sorting.user_id = user.id AND top_group_sorting.group_id = :defaultGroupId', [':defaultGroupId' => $defaultSortingGroupId]);
$this->addOrderBy('top_group_sorting.group_id DESC, last_login DESC');
}
}