mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Use all searchable profile fields in UserPicker searching (#6040)
* Use all searchable profile fields in UserPicker searching * Fix user picker Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
parent
a37ef7c455
commit
1c9109c817
@ -11,6 +11,7 @@ HumHub Changelog
|
||||
- Enh #6001: Added new `ContentActiveFixture` and migrated `PostFixture` to it
|
||||
- Fix #6007: Fix number of space members
|
||||
- Fix #6012: View own invisible profile
|
||||
- Fix #6030: Use all searchable profile fields in UserPicker searching
|
||||
- Fix #6026: Fix visibility members counter for guests
|
||||
|
||||
1.13.0 (December 21, 2022)
|
||||
|
@ -21,3 +21,6 @@ modules:
|
||||
port: 4444
|
||||
window_size: maximize
|
||||
restart: true
|
||||
capabilities:
|
||||
chromeOptions:
|
||||
args: ["--lang=en-US"]
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
namespace humhub\modules\user\models;
|
||||
|
||||
use humhub\modules\user\components\ActiveQueryUser;
|
||||
use Yii;
|
||||
use \humhub\modules\user\models\UserPicker;
|
||||
|
||||
/**
|
||||
* Special user model class for the purpose of searching users.
|
||||
@ -145,23 +145,17 @@ class UserFilter extends User
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter users by keyword
|
||||
*
|
||||
* @param ActiveQueryUser $query
|
||||
* @param string|array $keyword
|
||||
* @return ActiveQueryUser
|
||||
*/
|
||||
public static function addKeywordFilter($query, $keyword)
|
||||
{
|
||||
$query->joinWith('profile');
|
||||
$parts = explode(" ", $keyword);
|
||||
foreach ($parts as $part) {
|
||||
$query->andFilterWhere(
|
||||
['or',
|
||||
['like', 'user.email', $part],
|
||||
['like', 'user.username', $part],
|
||||
['like', 'profile.firstname', $part],
|
||||
['like', 'profile.lastname', $part],
|
||||
['like', 'profile.title', $part]
|
||||
]
|
||||
);
|
||||
}
|
||||
return $query;
|
||||
return $query->search($keyword);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ class UserPicker
|
||||
//Filter out users by means of the fillQuery or default the fillQuery
|
||||
$fillQuery = (isset($cfg['fillQuery'])) ? $cfg['fillQuery'] : UserFilter::find()->active();
|
||||
UserFilter::addKeywordFilter($fillQuery, $cfg['keyword'], ($cfg['maxResult'] - count($user)));
|
||||
$fillQuery->andFilterWhere(['not in', 'id', self::getUserIdArray($user)]);
|
||||
$fillQuery->andFilterWhere(['not in', 'user.id', self::getUserIdArray($user)]);
|
||||
$fillUser = $fillQuery->all();
|
||||
|
||||
//Either the additional users are disabled (by default) or we disable them by permission
|
||||
|
@ -196,7 +196,7 @@ class UserPicker extends \yii\base\Widget
|
||||
//Filter out users by means of the fillQuery or default the fillQuery
|
||||
$fillQuery = (isset($cfg['fillQuery'])) ? $cfg['fillQuery'] : UserFilter::find();
|
||||
UserFilter::addKeywordFilter($fillQuery, $cfg['keyword'], ($cfg['maxResult'] - count($user)));
|
||||
$fillQuery->andFilterWhere(['not in', 'id', self::getUserIdArray($user)]);
|
||||
$fillQuery->andFilterWhere(['not in', 'user.id', self::getUserIdArray($user)]);
|
||||
$fillUser = $fillQuery->all();
|
||||
|
||||
//Either the additional users are disabled (by default) or we disable them by permission
|
||||
|
Loading…
x
Reference in New Issue
Block a user