diff --git a/phpBB/assets/javascript/editor.js b/phpBB/assets/javascript/editor.js index 0ba7f81398..63d28e918a 100644 --- a/phpBB/assets/javascript/editor.js +++ b/phpBB/assets/javascript/editor.js @@ -390,8 +390,9 @@ function getCaretPosition(txtarea) { at: "@", displayTpl: function(data) { var avatar = (data.avatar.src) ? "" : - ""; - return "
  • " + avatar + "" + data.name + "
  • "; + "", + rank = (data.rank) ? "" + data.rank + "" : ''; + return "
  • " + avatar + "" + data.name + "" + rank + "
  • "; }, insertTpl: "[mention ${param}=${id}]${name}[/mention]", callbacks: { diff --git a/phpBB/config/default/container/services_mention.yml b/phpBB/config/default/container/services_mention.yml index 7a582bb6b6..286c16a8da 100644 --- a/phpBB/config/default/container/services_mention.yml +++ b/phpBB/config/default/container/services_mention.yml @@ -22,6 +22,8 @@ services: - '@dbal.conn' - '@user_loader' - '@user' + - '%core.root_path%' + - '%core.php_ext%' tags: - { name: mention.source } @@ -30,6 +32,8 @@ services: arguments: - '@dbal.conn' - '@user_loader' + - '%core.root_path%' + - '%core.php_ext%' tags: - { name: mention.source } @@ -39,5 +43,7 @@ services: - '@dbal.conn' - '@group_helper' - '@user' + - '%core.root_path%' + - '%core.php_ext%' tags: - { name: mention.source } diff --git a/phpBB/phpbb/mention/source/friend.php b/phpBB/phpbb/mention/source/friend.php index bf29daae61..d63efa4c72 100644 --- a/phpBB/phpbb/mention/source/friend.php +++ b/phpBB/phpbb/mention/source/friend.php @@ -21,11 +21,11 @@ class friend extends user /** * Constructor */ - public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, \phpbb\user $user) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, \phpbb\user $user, $phpbb_root_path, $phpEx) { $this->user = $user; - parent::__construct($db, $user_loader); + parent::__construct($db, $user_loader, $phpbb_root_path, $phpEx); } /** diff --git a/phpBB/phpbb/mention/source/group.php b/phpBB/phpbb/mention/source/group.php index 0d004814e3..c27c7d6d33 100644 --- a/phpBB/phpbb/mention/source/group.php +++ b/phpBB/phpbb/mention/source/group.php @@ -21,13 +21,26 @@ abstract class group implements source_interface /** @var \phpbb\group\helper */ protected $helper; + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + /** * Constructor */ - public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, $phpbb_root_path, $phpEx) { $this->db = $db; $this->helper = $helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $phpEx; + + if (!function_exists('phpbb_get_user_rank')) + { + include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); + } } /** @@ -93,6 +106,7 @@ abstract class group implements source_interface $names = []; foreach ($group_ids as $group_id) { + $group_rank = phpbb_get_user_rank($groups[$group_id], false); $names['g' . $group_id] = [ 'name' => $groups[$group_id]['group_name'], 'param' => 'group_id', @@ -101,6 +115,7 @@ abstract class group implements source_interface 'type' => 'group', 'src' => phpbb_get_group_avatar($groups[$group_id]), ], + 'rank' => $group_rank['title'], ]; } diff --git a/phpBB/phpbb/mention/source/user.php b/phpBB/phpbb/mention/source/user.php index 72f84d659c..69fe6b8bb8 100644 --- a/phpBB/phpbb/mention/source/user.php +++ b/phpBB/phpbb/mention/source/user.php @@ -21,13 +21,26 @@ abstract class user implements source_interface /** @var \phpbb\user_loader */ protected $user_loader; + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + /** * Constructor */ - public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, $phpbb_root_path, $phpEx) { $this->db = $db; $this->user_loader = $user_loader; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $phpEx; + + if (!function_exists('phpbb_get_user_rank')) + { + include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); + } } /** @@ -50,6 +63,7 @@ abstract class user implements source_interface $names = []; while ($row = $this->db->sql_fetchrow($res)) { + $user_rank = $this->user_loader->get_rank($row['user_id'], true); $names['u' . $row['user_id']] = [ 'name' => $row['username'], 'param' => 'user_id', @@ -58,6 +72,7 @@ abstract class user implements source_interface 'type' => 'user', 'src' => $this->user_loader->get_avatar($row['user_id'], true), ], + 'rank' => (isset($user_rank['rank_title'])) ? $user_rank['rank_title'] : '', ]; } diff --git a/phpBB/phpbb/mention/source/usergroup.php b/phpBB/phpbb/mention/source/usergroup.php index 1a0e20eff8..6d965961be 100644 --- a/phpBB/phpbb/mention/source/usergroup.php +++ b/phpBB/phpbb/mention/source/usergroup.php @@ -21,11 +21,11 @@ class usergroup extends group /** * Constructor */ - public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, \phpbb\user $user) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, \phpbb\user $user, $phpbb_root_path, $phpEx) { $this->user = $user; - parent::__construct($db, $helper); + parent::__construct($db, $helper, $phpbb_root_path, $phpEx); } /** diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 6d6a2b5cb1..127ac48c71 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -937,7 +937,7 @@ } .mention-avatar { - right: 8px; + right: 7px; left: auto; } diff --git a/phpBB/styles/prosilver/theme/forms.css b/phpBB/styles/prosilver/theme/forms.css index 85b58dbc1d..6a5048ad8d 100644 --- a/phpBB/styles/prosilver/theme/forms.css +++ b/phpBB/styles/prosilver/theme/forms.css @@ -287,7 +287,7 @@ fieldset.submit-buttons input { /* Mention dropdown */ .atwho-container .atwho-view { font-size: 12px; - min-width: 300px; + min-width: 260px; } .atwho-container .atwho-view ul li { @@ -304,11 +304,17 @@ fieldset.submit-buttons input { border-radius: 100%; position: absolute; top: 50%; - left: 8px; + left: 7px; display: inline-block; width: 30px; height: 30px; - margin-top: -15px; + margin-top: -16px; +} + +.mention-rank { + font-size: 10px; + display: block; + margin-top: 2px; } /* Input field styles