mirror of
https://github.com/humhub/humhub.git
synced 2025-01-29 12:28:06 +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 #5820: Selftest for base URL
|
||||||
- Enh #5891: Improve select2 width on people filters
|
- Enh #5891: Improve select2 width on people filters
|
||||||
- Fix #5903: ContentContainerModule::getEnabledContentContainers() returns an empty array
|
- Fix #5903: ContentContainerModule::getEnabledContentContainers() returns an empty array
|
||||||
|
- Enh #5908: New filter ActiveQueryUser->available()
|
||||||
|
@ -63,9 +63,8 @@ class MentioningController extends Controller
|
|||||||
|
|
||||||
// Find users
|
// Find users
|
||||||
$users = User::find()
|
$users = User::find()
|
||||||
->visible()
|
->available()
|
||||||
->search($keyword)
|
->search($keyword)
|
||||||
->filterBlockedUsers()
|
|
||||||
->limit($this->module->mentioningSearchBoxResultLimit)
|
->limit($this->module->mentioningSearchBoxResultLimit)
|
||||||
->orderBy(['user.last_login' => SORT_DESC])
|
->orderBy(['user.last_login' => SORT_DESC])
|
||||||
->all();
|
->all();
|
||||||
@ -100,9 +99,8 @@ class MentioningController extends Controller
|
|||||||
|
|
||||||
// Find space members
|
// Find space members
|
||||||
$users = Membership::getSpaceMembersQuery($space)
|
$users = Membership::getSpaceMembersQuery($space)
|
||||||
->visible()
|
->available()
|
||||||
->search($keyword)
|
->search($keyword)
|
||||||
->filterBlockedUsers()
|
|
||||||
->limit($this->module->mentioningSearchBoxResultLimit)
|
->limit($this->module->mentioningSearchBoxResultLimit)
|
||||||
->orderBy(['space_membership.last_visit' => SORT_DESC])
|
->orderBy(['space_membership.last_visit' => SORT_DESC])
|
||||||
->all();
|
->all();
|
||||||
@ -159,7 +157,7 @@ class MentioningController extends Controller
|
|||||||
// Find users followed to the Content
|
// Find users followed to the Content
|
||||||
$users = Follow::getFollowersQuery($object, true)
|
$users = Follow::getFollowersQuery($object, true)
|
||||||
->search($keyword)
|
->search($keyword)
|
||||||
->filterBlockedUsers()
|
->available()
|
||||||
->limit($this->module->mentioningSearchBoxResultLimit)
|
->limit($this->module->mentioningSearchBoxResultLimit)
|
||||||
->orderBy(['user.last_login' => SORT_DESC])
|
->orderBy(['user.last_login' => SORT_DESC])
|
||||||
->all();
|
->all();
|
||||||
|
@ -307,4 +307,16 @@ class ActiveQueryUser extends ActiveQuery
|
|||||||
return $this;
|
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();
|
parent::init();
|
||||||
|
|
||||||
$this->visible();
|
$this->available();
|
||||||
|
|
||||||
$this->filterBlockedUsers();
|
|
||||||
$this->filterByKeyword();
|
$this->filterByKeyword();
|
||||||
$this->filterByGroup();
|
$this->filterByGroup();
|
||||||
$this->filterByConnection();
|
$this->filterByConnection();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user