1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-13 21:26:28 +02:00

[ticket/13713] Do not show user's own name in the dropdown list

PHPBB3-13713
This commit is contained in:
lavigor
2018-07-22 02:58:11 +03:00
committed by Marc Alexander
parent aee1dfd837
commit 6f8467a2fa
5 changed files with 16 additions and 7 deletions

View File

@ -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;
}