diff --git a/phpBB/adm/style/acp_posting_buttons.html b/phpBB/adm/style/acp_posting_buttons.html index 770501cabb..ff453d16c7 100644 --- a/phpBB/adm/style/acp_posting_buttons.html +++ b/phpBB/adm/style/acp_posting_buttons.html @@ -13,7 +13,7 @@ -
data-mention-url="{U_MENTION_URL}" data-mention-names-limit="{S_MENTION_NAMES_LIMIT}" data-mention-batch-size="{S_MENTION_BATCH_SIZE}" data-topic-id="{S_TOPIC_ID}"> +
data-mention-url="{U_MENTION_URL}" data-mention-names-limit="{S_MENTION_NAMES_LIMIT}" data-mention-batch-size="{S_MENTION_BATCH_SIZE}" data-topic-id="{S_TOPIC_ID}" data-user-id="{S_USER_ID}"> diff --git a/phpBB/assets/javascript/editor.js b/phpBB/assets/javascript/editor.js index f1931f0bdf..9fc46d7efd 100644 --- a/phpBB/assets/javascript/editor.js +++ b/phpBB/assets/javascript/editor.js @@ -391,6 +391,7 @@ function getCaretPosition(txtarea) { let mentionBatchSize = $mentionDataContainer.data('mentionBatchSize'); let mentionNamesLimit = $mentionDataContainer.data('mentionNamesLimit'); let mentionTopicId = $mentionDataContainer.data('topicId'); + let mentionUserId = $mentionDataContainer.data('userId'); let queryInProgress = null; let cachedNames = []; let cachedSearchKey = 'name'; @@ -505,14 +506,20 @@ function getCaretPosition(txtarea) { for (i = 0, len = items.length; i < len; i++) { let item = items[i]; - // Exact matches should not be prioritised - they always come first - if (item.name === query) { - _exactMatch.push(items[i]); + // Check for unsupported type - in general, this should never happen + if (!_unsorted[item.type]) { continue; } - // Check for unsupported type - in general, this should never happen - if (!_unsorted[item.type]) { + // Current user doesn't want to mention themselves with "@" in most cases - + // do not waste list space with their own name + if (item.type === 'u' && item.id === String(mentionUserId)) { + continue; + } + + // Exact matches should not be prioritised - they always come first + if (item.name === query) { + _exactMatch.push(items[i]); continue; } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e00c2fc25d..fb65af2dc8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3972,6 +3972,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = 'S_REGISTER_ENABLED' => ($config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false, 'S_FORUM_ID' => $forum_id, 'S_TOPIC_ID' => $topic_id, + 'S_USER_ID' => $user->data['user_id'], 'S_LOGIN_ACTION' => ((!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id)), 'S_LOGIN_REDIRECT' => $s_login_redirect, diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index e1d3159e02..c06ae1f748 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -116,6 +116,7 @@ function adm_page_header($page_title) 'ICON_SYNC' => '', 'ICON_SYNC_DISABLED' => '', + 'S_USER_ID' => $user->data['user_id'], 'S_USER_LANG' => $user->lang['USER_LANG'], 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], 'S_CONTENT_ENCODING' => 'UTF-8', diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html index 449f677dd9..697035b850 100644 --- a/phpBB/styles/prosilver/template/posting_buttons.html +++ b/phpBB/styles/prosilver/template/posting_buttons.html @@ -39,7 +39,7 @@
-
data-mention-url="{U_MENTION_URL}" data-mention-names-limit="{S_MENTION_NAMES_LIMIT}" data-mention-batch-size="{S_MENTION_BATCH_SIZE}" data-topic-id="{S_TOPIC_ID}"> +
data-mention-url="{U_MENTION_URL}" data-mention-names-limit="{S_MENTION_NAMES_LIMIT}" data-mention-batch-size="{S_MENTION_BATCH_SIZE}" data-topic-id="{S_TOPIC_ID}" data-user-id="{S_USER_ID}">