diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 56b98e079f..58c1f2f16d 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -87,7 +87,6 @@ class factory implements \phpbb\textformatter\cache_interface 'mention' => "[MENTION={PARSE=/^(?[ug]):(?\d+)$/} profile_url={URL;optional;postFilter=#false} - color={COLOR;optional} ]{TEXT}[/MENTION]", 'quote' => "[QUOTE @@ -136,9 +135,6 @@ class factory implements \phpbb\textformatter\cache_interface - - color: #; - diff --git a/phpBB/phpbb/textformatter/s9e/mention_helper.php b/phpBB/phpbb/textformatter/s9e/mention_helper.php index bd641b8b24..e7b58f0b81 100644 --- a/phpBB/phpbb/textformatter/s9e/mention_helper.php +++ b/phpBB/phpbb/textformatter/s9e/mention_helper.php @@ -42,11 +42,6 @@ class mention_helper */ protected $group_profile_url; - /** - * @var array Array of users' and groups' colours for each cached ID - */ - protected $cached_colours = []; - /** * @var array Array of group IDs allowed to be mentioned by current user */ @@ -70,63 +65,6 @@ class mention_helper $this->group_profile_url = append_sid($root_path . 'memberlist.' . $php_ext, 'mode=group&g={ID}', false); } - /** - * Returns SQL query data for colour SELECT request - * - * @param string $type Name type ('u' for users, 'g' for groups) - * @return array Array of SQL SELECT query data for extracting colours for names - */ - protected function get_colours_sql($type) - { - switch ($type) - { - default: - case 'u': - return [ - 'SELECT' => 'u.user_colour as colour, u.user_id as id', - 'FROM' => [ - USERS_TABLE => 'u', - ], - 'WHERE' => $this->db->sql_in_set('u.user_type', [USER_NORMAL, USER_FOUNDER]), - ]; - case 'g': - return [ - 'SELECT' => 'g.group_colour as colour, g.group_id as id', - 'FROM' => [ - GROUPS_TABLE => 'g', - ], - ]; - } - } - - /** - * Caches colours of users and groups - */ - protected function cache_colours() - { - if (count($this->cached_colours) > 0) - { - return; - } - - $types = ['u', 'g']; - - foreach ($types as $type) - { - $this->cached_colours[$type] = []; - - $query = $this->db->sql_build_query('SELECT', $this->get_colours_sql($type)); - $result = $this->db->sql_query($query, 300); - - while ($row = $this->db->sql_fetchrow($result)) - { - $this->cached_colours[$type][$row['id']] = $row['colour']; - } - - $this->db->sql_freeresult($result); - } - } - /** * Inject dynamic metadata into MENTION tags in given XML * @@ -140,8 +78,6 @@ class mention_helper 'g' => $this->group_profile_url, ]; - $this->cache_colours(); - return TextFormatterUtils::replaceAttributes( $xml, 'MENTION', @@ -153,11 +89,6 @@ class mention_helper $id = $attributes['id']; $attributes['profile_url'] = str_replace('{ID}', $id, $profile_urls[$type]); - - if (!empty($this->cached_colours[$type][$id])) - { - $attributes['color'] = $this->cached_colours[$type][$id]; - } } return $attributes; diff --git a/tests/text_formatter/s9e/fixtures/mention.xml b/tests/text_formatter/s9e/fixtures/mention.xml index 9174029fd8..13553b1081 100644 --- a/tests/text_formatter/s9e/fixtures/mention.xml +++ b/tests/text_formatter/s9e/fixtures/mention.xml @@ -24,7 +24,7 @@ 3 Hidden group we are a member of 2 - FF0000 + @@ -53,7 +53,7 @@ test 0 0 - 00FF00 + diff --git a/tests/text_formatter/s9e/mention_helper_test.php b/tests/text_formatter/s9e/mention_helper_test.php index 0cbb978649..0665cd3ce5 100644 --- a/tests/text_formatter/s9e/mention_helper_test.php +++ b/tests/text_formatter/s9e/mention_helper_test.php @@ -82,12 +82,10 @@ class mention_helper_test extends phpbb_database_test_case [ '[mention=u:3]test[/mention]', 'mode=viewprofile&u=3', - 'color="00FF00"', ], [ '[mention=g:3]test[/mention]', 'mode=group&g=3', - 'color="FF0000"', ], ]; } @@ -95,11 +93,10 @@ class mention_helper_test extends phpbb_database_test_case /** * @dataProvider inject_metadata_data */ - public function test_inject_metadata($incoming_xml, $expected_profile_substring, $expected_colour) + public function test_inject_metadata($incoming_xml, $expected_profile_substring) { $result = $this->mention_helper->inject_metadata($incoming_xml); $this->assertContains($expected_profile_substring, $result); - $this->assertContains($expected_colour, $result); } public function get_mentioned_user_ids_data()