diff --git a/phpBB/assets/javascript/editor.js b/phpBB/assets/javascript/editor.js index 9fc46d7efd..9bd49cc8ed 100644 --- a/phpBB/assets/javascript/editor.js +++ b/phpBB/assets/javascript/editor.js @@ -430,10 +430,6 @@ function getCaretPosition(txtarea) { return _results; } - function getNumberOfMatchedCachedNames(query) { - return getMatchedNames(query, cachedNames, cachedSearchKey).length; - } - function remoteFilter(query, callback) { /* * Do not make a new request until the previous one for the same query is returned @@ -456,7 +452,7 @@ function getCaretPosition(txtarea) { * all relevant names have been fetched from the server */ if (cachedNamesForQuery && - (getNumberOfMatchedCachedNames(query) >= mentionNamesLimit || + (getMatchedNames(query, cachedNamesForQuery, cachedSearchKey).length >= mentionNamesLimit || cachedNamesForQuery.length < mentionBatchSize)) { callback(cachedNamesForQuery); return; @@ -494,7 +490,7 @@ function getCaretPosition(txtarea) { sorter: function(query, items, searchKey) { let i; let len; - let highestPriorities = {u: 0, g: 0}; + let highestPriorities = {u: 1, g: 1}; let _unsorted = {u: {}, g: {}}; let _exactMatch = []; let _results = []; @@ -530,7 +526,7 @@ function getCaretPosition(txtarea) { } // Priority is calculated as the sum of priorities from different sources - _unsorted[item.type][item.id].priority += parseFloat(item.priority); + _unsorted[item.type][item.id].priority += parseFloat(item.priority.toString()); // Calculate the highest priority - we'll give it to group names highestPriorities[item.type] = Math.max(highestPriorities[item.type], _unsorted[item.type][item.id].priority); diff --git a/phpBB/phpbb/mention/source/base_user.php b/phpBB/phpbb/mention/source/base_user.php index cb6ae1eaca..a9c0fdaf82 100644 --- a/phpBB/phpbb/mention/source/base_user.php +++ b/phpBB/phpbb/mention/source/base_user.php @@ -100,6 +100,8 @@ abstract class base_user implements source_interface $user_ids[] = $row['user_id']; } + $this->db->sql_freeresult($result); + // Load all user data with a single SQL query, needed for ranks and avatars $this->user_loader->load_users($user_ids); diff --git a/phpBB/phpbb/mention/source/topic.php b/phpBB/phpbb/mention/source/topic.php index 86b01d37fc..c1b78542c8 100644 --- a/phpBB/phpbb/mention/source/topic.php +++ b/phpBB/phpbb/mention/source/topic.php @@ -46,7 +46,7 @@ class topic extends base_user * Results will be cached on a per-topic basis */ $query = $this->db->sql_build_query('SELECT', [ - 'SELECT' => 'u.username, u.user_id, t.topic_poster', + 'SELECT' => 'u.username_clean, u.username, u.user_id, t.topic_poster', 'FROM' => [ USERS_TABLE => 'u', ],