[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
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
5 changed files with 16 additions and 7 deletions

View file

@ -13,7 +13,7 @@
<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js --> <!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js -->
<!-- EVENT acp_posting_buttons_before --> <!-- EVENT acp_posting_buttons_before -->
<div id="format-buttons"<!-- IF S_ALLOW_MENTIONS --> 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}"<!-- ENDIF -->> <div id="format-buttons"<!-- IF S_ALLOW_MENTIONS --> 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}"<!-- ENDIF -->>
<input type="button" class="button2" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}" /> <input type="button" class="button2" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}" />
<input type="button" class="button2" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" title="{L_BBCODE_I_HELP}" /> <input type="button" class="button2" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" title="{L_BBCODE_I_HELP}" />
<input type="button" class="button2" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onclick="bbstyle(4)" title="{L_BBCODE_U_HELP}" /> <input type="button" class="button2" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onclick="bbstyle(4)" title="{L_BBCODE_U_HELP}" />

View file

@ -391,6 +391,7 @@ function getCaretPosition(txtarea) {
let mentionBatchSize = $mentionDataContainer.data('mentionBatchSize'); let mentionBatchSize = $mentionDataContainer.data('mentionBatchSize');
let mentionNamesLimit = $mentionDataContainer.data('mentionNamesLimit'); let mentionNamesLimit = $mentionDataContainer.data('mentionNamesLimit');
let mentionTopicId = $mentionDataContainer.data('topicId'); let mentionTopicId = $mentionDataContainer.data('topicId');
let mentionUserId = $mentionDataContainer.data('userId');
let queryInProgress = null; let queryInProgress = null;
let cachedNames = []; let cachedNames = [];
let cachedSearchKey = 'name'; let cachedSearchKey = 'name';
@ -505,14 +506,20 @@ function getCaretPosition(txtarea) {
for (i = 0, len = items.length; i < len; i++) { for (i = 0, len = items.length; i < len; i++) {
let item = items[i]; let item = items[i];
// Exact matches should not be prioritised - they always come first // Check for unsupported type - in general, this should never happen
if (item.name === query) { if (!_unsorted[item.type]) {
_exactMatch.push(items[i]);
continue; continue;
} }
// Check for unsupported type - in general, this should never happen // Current user doesn't want to mention themselves with "@" in most cases -
if (!_unsorted[item.type]) { // 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; continue;
} }

View file

@ -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_REGISTER_ENABLED' => ($config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false,
'S_FORUM_ID' => $forum_id, 'S_FORUM_ID' => $forum_id,
'S_TOPIC_ID' => $topic_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_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, 'S_LOGIN_REDIRECT' => $s_login_redirect,

View file

@ -116,6 +116,7 @@ function adm_page_header($page_title)
'ICON_SYNC' => '<i class="icon acp-icon acp-icon-resync fa-refresh fa-fw" title="' . $user->lang('RESYNC') . '"></i>', 'ICON_SYNC' => '<i class="icon acp-icon acp-icon-resync fa-refresh fa-fw" title="' . $user->lang('RESYNC') . '"></i>',
'ICON_SYNC_DISABLED' => '<i class="icon acp-icon acp-icon-disabled fa-refresh fa-fw" title="' . $user->lang('RESYNC') . '"></i>', 'ICON_SYNC_DISABLED' => '<i class="icon acp-icon acp-icon-disabled fa-refresh fa-fw" title="' . $user->lang('RESYNC') . '"></i>',
'S_USER_ID' => $user->data['user_id'],
'S_USER_LANG' => $user->lang['USER_LANG'], 'S_USER_LANG' => $user->lang['USER_LANG'],
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],
'S_CONTENT_ENCODING' => 'UTF-8', 'S_CONTENT_ENCODING' => 'UTF-8',

View file

@ -39,7 +39,7 @@
</div> </div>
<!-- EVENT posting_editor_buttons_before --> <!-- EVENT posting_editor_buttons_before -->
<div id="format-buttons" class="format-buttons"<!-- IF S_ALLOW_MENTIONS --> 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}"<!-- ENDIF -->> <div id="format-buttons" class="format-buttons"<!-- IF S_ALLOW_MENTIONS --> 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}"<!-- ENDIF -->>
<button type="button" class="button button-icon-only bbcode-b" accesskey="b" name="addbbcode0" value=" B " onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}"> <button type="button" class="button button-icon-only bbcode-b" accesskey="b" name="addbbcode0" value=" B " onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}">
{{ Icon('iconify', 'mdi:format-bold', '', true, 'c-button-icon') }} {{ Icon('iconify', 'mdi:format-bold', '', true, 'c-button-icon') }}
</button> </button>