diff --git a/phpBB/adm/style/acp_posting_buttons.html b/phpBB/adm/style/acp_posting_buttons.html
index c99a168f12..e032b8e77b 100644
--- a/phpBB/adm/style/acp_posting_buttons.html
+++ b/phpBB/adm/style/acp_posting_buttons.html
@@ -8,6 +8,8 @@
// ]]>
+{% include 'mentions_templates.html' %}
+
diff --git a/phpBB/assets/javascript/mentions.js b/phpBB/assets/javascript/mentions.js
index 42de121b6b..94ac595cf7 100644
--- a/phpBB/assets/javascript/mentions.js
+++ b/phpBB/assets/javascript/mentions.js
@@ -24,6 +24,7 @@
const mentionNamesLimit = $mentionDataContainer.data('mentionNamesLimit');
const mentionTopicId = $mentionDataContainer.data('topicId');
const mentionUserId = $mentionDataContainer.data('userId');
+ const $mentionAvatarTemplate = $('[data-id="mentions-avatar-span"]');
let queryInProgress = null;
const cachedNames = [];
const cachedAll = [];
@@ -51,15 +52,26 @@
* @return {string} Avatar HTML
*/
function getAvatar(data, type) {
- const avatarToHtml = avatarData => {
- if (avatarData.html === '') {
- return '
';
- }
+ if (data.html === '' && data.src === '') {
+ return defaultAvatar(type);
+ }
- return avatarData.html;
- };
+ const $avatarSpan = $mentionAvatarTemplate.clone();
+ $avatarSpan.removeAttr('style'); // Remove automatically added display: none
- return data.html === '' && data.src === '' ? defaultAvatar(type) : '' + avatarToHtml(data) + '';
+ if (data.html === '') {
+ const $avatarImg = $avatarSpan.find('img');
+ $avatarImg.attr({
+ src: data.src,
+ width: data.width,
+ height: data.height,
+ alt: data.title,
+ });
+ } else {
+ $avatarSpan.html(data.html);
+ }
+
+ return $avatarSpan.get(0).outerHTML;
}
/**
diff --git a/phpBB/styles/prosilver/template/mentions_templates.html b/phpBB/styles/prosilver/template/mentions_templates.html
new file mode 100644
index 0000000000..bd1820ea0e
--- /dev/null
+++ b/phpBB/styles/prosilver/template/mentions_templates.html
@@ -0,0 +1 @@
+
diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html
index fa36310198..049c81b07e 100644
--- a/phpBB/styles/prosilver/template/posting_buttons.html
+++ b/phpBB/styles/prosilver/template/posting_buttons.html
@@ -26,6 +26,8 @@
}
+{% include 'mentions_templates.html' %}
+