mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
New filter ActiveQueryUser->available() (#5908)
* New filter ActiveQueryUser->available() * Update CHANGELOG-DEV.md
This commit is contained in:
parent
1fae0b8ca8
commit
ed9c7a1770
@ -11,3 +11,4 @@ HumHub Changelog
|
||||
- Enh #5820: Selftest for base URL
|
||||
- Enh #5891: Improve select2 width on people filters
|
||||
- Fix #5903: ContentContainerModule::getEnabledContentContainers() returns an empty array
|
||||
- Enh #5908: New filter ActiveQueryUser->available()
|
||||
|
@ -63,9 +63,8 @@ class MentioningController extends Controller
|
||||
|
||||
// Find users
|
||||
$users = User::find()
|
||||
->visible()
|
||||
->available()
|
||||
->search($keyword)
|
||||
->filterBlockedUsers()
|
||||
->limit($this->module->mentioningSearchBoxResultLimit)
|
||||
->orderBy(['user.last_login' => SORT_DESC])
|
||||
->all();
|
||||
@ -100,9 +99,8 @@ class MentioningController extends Controller
|
||||
|
||||
// Find space members
|
||||
$users = Membership::getSpaceMembersQuery($space)
|
||||
->visible()
|
||||
->available()
|
||||
->search($keyword)
|
||||
->filterBlockedUsers()
|
||||
->limit($this->module->mentioningSearchBoxResultLimit)
|
||||
->orderBy(['space_membership.last_visit' => SORT_DESC])
|
||||
->all();
|
||||
@ -159,7 +157,7 @@ class MentioningController extends Controller
|
||||
// Find users followed to the Content
|
||||
$users = Follow::getFollowersQuery($object, true)
|
||||
->search($keyword)
|
||||
->filterBlockedUsers()
|
||||
->available()
|
||||
->limit($this->module->mentioningSearchBoxResultLimit)
|
||||
->orderBy(['user.last_login' => SORT_DESC])
|
||||
->all();
|
||||
|
@ -307,4 +307,16 @@ class ActiveQueryUser extends ActiveQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter users which are available for the given $user or for the current User
|
||||
*
|
||||
* @since 1.13
|
||||
* @param UserModel|null $user
|
||||
* @return ActiveQueryUser
|
||||
*/
|
||||
public function available(?UserModel $user = null): ActiveQueryUser
|
||||
{
|
||||
return $this->visible()->filterBlockedUsers($user);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,9 +54,8 @@ class PeopleQuery extends ActiveQueryUser
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->visible();
|
||||
$this->available();
|
||||
|
||||
$this->filterBlockedUsers();
|
||||
$this->filterByKeyword();
|
||||
$this->filterByGroup();
|
||||
$this->filterByConnection();
|
||||
|
Loading…
x
Reference in New Issue
Block a user