diff --git a/phpBB/adm/style/acp_posting_buttons.html b/phpBB/adm/style/acp_posting_buttons.html index ff453d16c7..08c81de0c0 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-user-id="{S_USER_ID}"> +
data-mention-url="{U_MENTION_URL}" data-mention-names-limit="{S_MENTION_NAMES_LIMIT}" 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 9bd49cc8ed..9a05b0a458 100644 --- a/phpBB/assets/javascript/editor.js +++ b/phpBB/assets/javascript/editor.js @@ -388,19 +388,19 @@ function getCaretPosition(txtarea) { function Mentions() { let $mentionDataContainer = $('[data-mention-url]:first'); let mentionURL = $mentionDataContainer.data('mentionUrl'); - 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 cachedAll = []; let cachedSearchKey = 'name'; function defaultAvatar(type) { return (type === 'group') ? '' : ''; } - function getCachedNames(query) { + function getCachedKeyword(query) { if (!cachedNames) { return null; } @@ -410,11 +410,11 @@ function getCaretPosition(txtarea) { for (i = query.length; i > 0; i--) { let startStr = query.substr(0, i); if (cachedNames[startStr]) { - return cachedNames[startStr]; + return startStr; } } - return cachedNames['']; + return ''; } function getMatchedNames(query, items, searchKey) { @@ -442,7 +442,8 @@ function getCaretPosition(txtarea) { return; } - let cachedNamesForQuery = getCachedNames(query); + let cachedKeyword = getCachedKeyword(query), + cachedNamesForQuery = (cachedKeyword) ? cachedNames[cachedKeyword] : null; /* * Use cached values when we can: @@ -453,7 +454,7 @@ function getCaretPosition(txtarea) { */ if (cachedNamesForQuery && (getMatchedNames(query, cachedNamesForQuery, cachedSearchKey).length >= mentionNamesLimit || - cachedNamesForQuery.length < mentionBatchSize)) { + cachedAll[cachedKeyword])) { callback(cachedNamesForQuery); return; } @@ -462,7 +463,8 @@ function getCaretPosition(txtarea) { let params = {keyword: query, topic_id: mentionTopicId, _referer: location.href}; $.getJSON(mentionURL, params, function(data) { - cachedNames[query] = data; + cachedNames[query] = data.names; + cachedAll[query] = data.all; callback(data); }).always(function() { queryInProgress = null; diff --git a/phpBB/config/default/container/services_mention.yml b/phpBB/config/default/container/services_mention.yml index 917da928d5..e2861b984c 100644 --- a/phpBB/config/default/container/services_mention.yml +++ b/phpBB/config/default/container/services_mention.yml @@ -20,6 +20,7 @@ services: abstract: true arguments: - '@dbal.conn' + - '@config' - '@group_helper' - '@user' - '@auth' diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 62daba0373..8e549b4b34 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -223,6 +223,7 @@ class acp_board 'legend3' => 'MENTIONS', 'allow_mentions' => array('lang' => 'ALLOW_MENTIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'mention_names_limit' => array('lang' => 'MENTION_NAMES_LIMIT', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), + 'mention_batch_size' => array('lang' => 'MENTION_BATCH_SIZE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => true), 'legend4' => 'ACP_SUBMIT_CHANGES', ) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index fb65af2dc8..be8eecfe2a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3947,7 +3947,6 @@ function page_header($page_title = '', $display_online_list = false, $item_id = 'U_FEED' => $controller_helper->route('phpbb_feed_index'), 'S_ALLOW_MENTIONS' => ($config['allow_mentions'] && $auth->acl_get('u_mention') && (empty($forum_id) || $auth->acl_get('f_mention', $forum_id))) ? true : false, - 'S_MENTION_BATCH_SIZE' => 100, // TODO: do not hardcode the value 'S_MENTION_NAMES_LIMIT' => $config['mention_names_limit'], 'U_MENTION_URL' => $controller_helper->route('phpbb_mention_controller'), diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index c06ae1f748..ba1584ab82 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -90,7 +90,6 @@ function adm_page_header($page_title) 'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"), 'S_ALLOW_MENTIONS' => ($config['allow_mentions'] && $auth->acl_get('u_mention')) ? true : false, - 'S_MENTION_BATCH_SIZE' => 100, // TODO: do not hardcode the value 'S_MENTION_NAMES_LIMIT' => $config['mention_names_limit'], 'U_MENTION_URL' => $controller_helper->route('phpbb_mention_controller'), diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index a11b1e1a9c..e8294f0a8f 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -235,6 +235,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_img_height INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_img_width', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_smilies', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_urls', '5'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('mention_batch_size', '50'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('mention_names_limit', '10'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_name_chars', '3'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index d4aba08f3c..8d85f898a0 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -189,6 +189,8 @@ $lang = array_merge($lang, array( 'MAX_POST_URLS' => 'Maximum links per post', 'MAX_POST_URLS_EXPLAIN' => 'Maximum number of URLs in a post. Set to 0 for unlimited links.', 'MENTIONS' => 'Mentions', + 'MENTION_BATCH_SIZE' => 'Maximum number of names fetched from each source of names for a single request', + 'MENTION_BATCH_SIZE_EXPLAIN' => 'Examples of sources: friends, topic repliers, group members etc.', 'MENTION_NAMES_LIMIT' => 'Maximum number of names in dropdown list', 'MIN_CHAR_LIMIT' => 'Minimum characters per post/message', 'MIN_CHAR_LIMIT_EXPLAIN' => 'The minimum number of characters the user need to enter within a post/private message. The minimum for this setting is 1.', diff --git a/phpBB/phpbb/db/migration/data/v330/add_mention_settings.php b/phpBB/phpbb/db/migration/data/v330/add_mention_settings.php index 1f38d919b2..c0e9a8cf58 100644 --- a/phpBB/phpbb/db/migration/data/v330/add_mention_settings.php +++ b/phpBB/phpbb/db/migration/data/v330/add_mention_settings.php @@ -19,6 +19,7 @@ class add_mention_settings extends \phpbb\db\migration\migration { return array( array('config.add', array('allow_mentions', true)), + array('config.add', array('mention_batch_size', 50)), array('config.add', array('mention_names_limit', 10)), // Set up user permissions diff --git a/phpBB/phpbb/mention/controller/mention.php b/phpBB/phpbb/mention/controller/mention.php index 770f84b015..42e0d217ef 100644 --- a/phpBB/phpbb/mention/controller/mention.php +++ b/phpBB/phpbb/mention/controller/mention.php @@ -52,12 +52,16 @@ class mention $keyword = $this->request->variable('keyword', '', true); $topic_id = $this->request->variable('topic_id', 0); $names = []; + $hasNamesRemaining = false; foreach ($this->mention_sources as $source) { - $source->get($names, $keyword, $topic_id); + $hasNamesRemaining = !$source->get($names, $keyword, $topic_id) || $hasNamesRemaining; } - return new JsonResponse(array_values($names)); + return new JsonResponse([ + 'names' => array_values($names), + 'all' => !$hasNamesRemaining, + ]); } } diff --git a/phpBB/phpbb/mention/source/base_group.php b/phpBB/phpbb/mention/source/base_group.php index e6281bcbac..c8d498ce81 100644 --- a/phpBB/phpbb/mention/source/base_group.php +++ b/phpBB/phpbb/mention/source/base_group.php @@ -18,6 +18,9 @@ abstract class base_group implements source_interface /** @var \phpbb\db\driver\driver_interface */ protected $db; + /** @var \phpbb\config\config */ + protected $config; + /** @var \phpbb\group\helper */ protected $helper; @@ -39,9 +42,10 @@ abstract class base_group implements source_interface /** * Constructor */ - public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $phpEx) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\group\helper $helper, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $phpEx) { $this->db = $db; + $this->config = $config; $this->helper = $helper; $this->user = $user; $this->auth = $auth; @@ -138,8 +142,15 @@ abstract class base_group implements source_interface $matches = preg_grep('/^' . preg_quote($keyword) . '.*/i', $groups['names']); $group_ids = array_intersect($group_ids, array_flip($matches)); + $i = 0; foreach ($group_ids as $group_id) { + if ($i >= $this->config['mention_batch_size']) + { + // Do not exceed the names limit + return false; + } + $group_rank = phpbb_get_user_rank($groups[$group_id], false); array_push($names, [ 'name' => $groups[$group_id]['group_name'], @@ -152,6 +163,10 @@ abstract class base_group implements source_interface 'rank' => (isset($group_rank['title'])) ? $group_rank['title'] : '', 'priority' => $this->get_priority($groups[$group_id]), ]); + + $i++; } + + return true; } } diff --git a/phpBB/phpbb/mention/source/base_user.php b/phpBB/phpbb/mention/source/base_user.php index 2fd6cf5f98..9a7f484379 100644 --- a/phpBB/phpbb/mention/source/base_user.php +++ b/phpBB/phpbb/mention/source/base_user.php @@ -15,9 +15,6 @@ namespace phpbb\mention\source; abstract class base_user implements source_interface { - /** @var int */ - const NAMES_BATCH_SIZE = 100; - /** @var \phpbb\db\driver\driver_interface */ protected $db; @@ -73,6 +70,7 @@ abstract class base_user implements source_interface */ public function get(array &$names, $keyword, $topic_id) { + $fetched_all = false; $keyword = utf8_clean_string($keyword); // Do not query all possible users (just a moderate amount), cache results for 5 minutes @@ -81,12 +79,13 @@ abstract class base_user implements source_interface $i = 0; $users = []; $user_ids = []; - while ($i < self::NAMES_BATCH_SIZE) + while ($i < $this->config['mention_batch_size']) { $row = $this->db->sql_fetchrow($result); if (!$row) { + $fetched_all = true; break; } @@ -100,6 +99,24 @@ abstract class base_user implements source_interface $user_ids[] = $row['user_id']; } + // Determine whether all usernames were fetched in current batch + if (!$fetched_all) + { + $fetched_all = true; + + while ($row = $this->db->sql_fetchrow($result)) + { + if (!empty($keyword) && strpos($row['username_clean'], $keyword) !== 0) + { + continue; + } + + // At least one username hasn't been fetched - exit loop + $fetched_all = false; + break; + } + } + $this->db->sql_freeresult($result); // Load all user data with a single SQL query, needed for ranks and avatars @@ -120,5 +137,7 @@ abstract class base_user implements source_interface 'priority' => $this->get_priority($user), ]); } + + return $fetched_all; } } diff --git a/phpBB/phpbb/mention/source/source_interface.php b/phpBB/phpbb/mention/source/source_interface.php index 075bea295d..b9e126324b 100644 --- a/phpBB/phpbb/mention/source/source_interface.php +++ b/phpBB/phpbb/mention/source/source_interface.php @@ -22,6 +22,7 @@ interface source_interface * @param array $names Array of already fetched data with names * @param string $keyword Search string * @param int $topic_id Current topic ID + * @return bool Whether there are no more satisfying names left */ public function get(array &$names, $keyword, $topic_id); diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html index 697035b850..22b9e8a7b0 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-user-id="{S_USER_ID}"> +
data-mention-url="{U_MENTION_URL}" data-mention-names-limit="{S_MENTION_NAMES_LIMIT}" data-topic-id="{S_TOPIC_ID}" data-user-id="{S_USER_ID}"> diff --git a/tests/mention/controller_test.php b/tests/mention/controller_test.php index ffc65e7c18..4294e7365d 100644 --- a/tests/mention/controller_test.php +++ b/tests/mention/controller_test.php @@ -55,6 +55,7 @@ class phpbb_mention_controller_test extends phpbb_database_test_case // Config $config = new \phpbb\config\config(array( 'allow_mentions' => true, + 'mention_batch_size' => 8, 'mention_names_limit' => 3, )); @@ -143,491 +144,493 @@ class phpbb_mention_controller_test extends phpbb_database_test_case /** * NOTE: * 1) in production comparison with 'myself' is being done in JS - * 2) mention_names_limit does not limit the number of returned items - * 3) team members of hidden groups can also be mentioned (because they are shown on teampage) + * 2) team members of hidden groups can also be mentioned (because they are shown on teampage) */ return [ ['', 0, [ - [ - 'name' => 'friend', - 'type' => 'u', - 'id' => 7, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + 'names' => [ + [ + 'name' => 'friend', + 'type' => 'u', + 'id' => 7, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 1, - ], - [ - 'name' => 'Group we are a member of', - 'type' => 'g', - 'id' => 3, - 'avatar' => [ - 'type' => 'group', - 'img' => '', + [ + 'name' => 'Group we are a member of', + 'type' => 'g', + 'id' => 3, + 'avatar' => [ + 'type' => 'group', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'Normal group', - 'type' => 'g', - 'id' => 1, - 'avatar' => [ - 'type' => 'group', - 'img' => '', + [ + 'name' => 'Normal group', + 'type' => 'g', + 'id' => 1, + 'avatar' => [ + 'type' => 'group', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'team_member_hidden', - 'type' => 'u', - 'id' => 6, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_hidden', + 'type' => 'u', + 'id' => 6, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 1, - ], - [ - 'name' => 'team_member_normal', - 'type' => 'u', - 'id' => 5, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_normal', + 'type' => 'u', + 'id' => 5, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 1, - ], - [ - 'name' => 'myself', - 'type' => 'u', - 'id' => 2, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'myself', + 'type' => 'u', + 'id' => 2, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'poster', - 'type' => 'u', - 'id' => 3, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'poster', + 'type' => 'u', + 'id' => 3, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'replier', - 'type' => 'u', - 'id' => 4, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'replier', + 'type' => 'u', + 'id' => 4, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'team_member_normal', - 'type' => 'u', - 'id' => 5, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_normal', + 'type' => 'u', + 'id' => 5, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'team_member_hidden', - 'type' => 'u', - 'id' => 6, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_hidden', + 'type' => 'u', + 'id' => 6, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'friend', - 'type' => 'u', - 'id' => 7, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'friend', + 'type' => 'u', + 'id' => 7, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test', - 'type' => 'u', - 'id' => 8, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'test', + 'type' => 'u', + 'id' => 8, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test1', - 'type' => 'u', - 'id' => 9, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'test1', + 'type' => 'u', + 'id' => 9, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test2', - 'type' => 'u', - 'id' => 10, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'Group we are a member of', + 'type' => 'g', + 'id' => 3, + 'avatar' => [ + 'type' => 'group', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test3', - 'type' => 'u', - 'id' => 11, - 'avatar' => [ - 'type' => 'user', - 'img' => '', - ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'Group we are a member of', - 'type' => 'g', - 'id' => 3, - 'avatar' => [ - 'type' => 'group', - 'img' => '', - ], - 'rank' => '', - 'priority' => 1, ], + 'all' => false, ]], ['', 1, [ - [ - 'name' => 'friend', - 'type' => 'u', - 'id' => 7, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + 'names' => [ + [ + 'name' => 'friend', + 'type' => 'u', + 'id' => 7, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 1, - ], - [ - 'name' => 'Group we are a member of', - 'type' => 'g', - 'id' => 3, - 'avatar' => [ - 'type' => 'group', - 'img' => '', + [ + 'name' => 'Group we are a member of', + 'type' => 'g', + 'id' => 3, + 'avatar' => [ + 'type' => 'group', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'Normal group', - 'type' => 'g', - 'id' => 1, - 'avatar' => [ - 'type' => 'group', - 'img' => '', + [ + 'name' => 'Normal group', + 'type' => 'g', + 'id' => 1, + 'avatar' => [ + 'type' => 'group', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'team_member_hidden', - 'type' => 'u', - 'id' => 6, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_hidden', + 'type' => 'u', + 'id' => 6, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 1, - ], - [ - 'name' => 'team_member_normal', - 'type' => 'u', - 'id' => 5, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_normal', + 'type' => 'u', + 'id' => 5, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 1, - ], - [ - 'name' => 'replier', - 'type' => 'u', - 'id' => 4, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'replier', + 'type' => 'u', + 'id' => 4, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 1, - ], - [ - 'name' => 'poster', - 'type' => 'u', - 'id' => 3, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'poster', + 'type' => 'u', + 'id' => 3, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 5, ], - 'rank' => '', - 'priority' => 5, - ], - [ - 'name' => 'myself', - 'type' => 'u', - 'id' => 2, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'myself', + 'type' => 'u', + 'id' => 2, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'poster', - 'type' => 'u', - 'id' => 3, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'poster', + 'type' => 'u', + 'id' => 3, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'replier', - 'type' => 'u', - 'id' => 4, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'replier', + 'type' => 'u', + 'id' => 4, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'team_member_normal', - 'type' => 'u', - 'id' => 5, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_normal', + 'type' => 'u', + 'id' => 5, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'team_member_hidden', - 'type' => 'u', - 'id' => 6, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_hidden', + 'type' => 'u', + 'id' => 6, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'friend', - 'type' => 'u', - 'id' => 7, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'friend', + 'type' => 'u', + 'id' => 7, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test', - 'type' => 'u', - 'id' => 8, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'test', + 'type' => 'u', + 'id' => 8, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test1', - 'type' => 'u', - 'id' => 9, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'test1', + 'type' => 'u', + 'id' => 9, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test2', - 'type' => 'u', - 'id' => 10, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'Group we are a member of', + 'type' => 'g', + 'id' => 3, + 'avatar' => [ + 'type' => 'group', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test3', - 'type' => 'u', - 'id' => 11, - 'avatar' => [ - 'type' => 'user', - 'img' => '', - ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'Group we are a member of', - 'type' => 'g', - 'id' => 3, - 'avatar' => [ - 'type' => 'group', - 'img' => '', - ], - 'rank' => '', - 'priority' => 1, ], + 'all' => false, ]], ['t', 1, [ - [ - 'name' => 'team_member_hidden', - 'type' => 'u', - 'id' => 6, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + 'names' => [ + [ + 'name' => 'team_member_hidden', + 'type' => 'u', + 'id' => 6, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 1, - ], - [ - 'name' => 'team_member_normal', - 'type' => 'u', - 'id' => 5, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_normal', + 'type' => 'u', + 'id' => 5, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 1, ], - 'rank' => '', - 'priority' => 1, - ], - [ - 'name' => 'team_member_normal', - 'type' => 'u', - 'id' => 5, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_normal', + 'type' => 'u', + 'id' => 5, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'team_member_hidden', - 'type' => 'u', - 'id' => 6, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'team_member_hidden', + 'type' => 'u', + 'id' => 6, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test', - 'type' => 'u', - 'id' => 8, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'test', + 'type' => 'u', + 'id' => 8, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test1', - 'type' => 'u', - 'id' => 9, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'test1', + 'type' => 'u', + 'id' => 9, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test2', - 'type' => 'u', - 'id' => 10, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'test2', + 'type' => 'u', + 'id' => 10, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test3', - 'type' => 'u', - 'id' => 11, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + [ + 'name' => 'test3', + 'type' => 'u', + 'id' => 11, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, ], + 'all' => true, ]], ['test', 1, [ - [ - 'name' => 'test', - 'type' => 'u', - 'id' => 8, - 'avatar' => [ - 'type' => 'user', - 'img' => '', + 'names' => [ + [ + 'name' => 'test', + 'type' => 'u', + 'id' => 8, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, + ], + [ + 'name' => 'test1', + 'type' => 'u', + 'id' => 9, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, + ], + [ + 'name' => 'test2', + 'type' => 'u', + 'id' => 10, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, + ], + [ + 'name' => 'test3', + 'type' => 'u', + 'id' => 11, + 'avatar' => [ + 'type' => 'user', + 'img' => '', + ], + 'rank' => '', + 'priority' => 0, ], - 'rank' => '', - 'priority' => 0, ], - [ + 'all' => true, + ]], + ['test1', 1, [ + 'names' => [[ 'name' => 'test1', 'type' => 'u', 'id' => 9, @@ -637,41 +640,9 @@ class phpbb_mention_controller_test extends phpbb_database_test_case ], 'rank' => '', 'priority' => 0, - ], - [ - 'name' => 'test2', - 'type' => 'u', - 'id' => 10, - 'avatar' => [ - 'type' => 'user', - 'img' => '', - ], - 'rank' => '', - 'priority' => 0, - ], - [ - 'name' => 'test3', - 'type' => 'u', - 'id' => 11, - 'avatar' => [ - 'type' => 'user', - 'img' => '', - ], - 'rank' => '', - 'priority' => 0, - ], + ]], + 'all' => true, ]], - ['test1', 1, [[ - 'name' => 'test1', - 'type' => 'u', - 'id' => 9, - 'avatar' => [ - 'type' => 'user', - 'img' => '', - ], - 'rank' => '', - 'priority' => 0, - ]]], ]; }