change regex for name-searching to match synapse behaviour

This commit is contained in:
2018-03-08 23:04:58 +01:00
parent 8c854f716d
commit b131e6b09e

View File

@@ -281,12 +281,12 @@ class mxDatabase
$term = filter_var($search_term, FILTER_SANITIZE_STRING);
$result = array();
$sql = "SELECT COUNT(*) FROM logins WHERE"
. " localpart LIKE '%" . $term . "%';";
. " localpart LIKE '" . $term . "%';";
$res = $this->db->query($sql);
if ($res->fetchColumn() > 0) {
$sql = "SELECT first_name, last_name, localpart FROM logins WHERE"
. " localpart LIKE '%" . $term . "%';";
. " localpart LIKE '" . $term . "%';";
foreach ($this->db->query($sql) as $row) {
array_push($result, [
"display_name" => $row["first_name"] . " " . $row["last_name"],