Skip to content

Node.js based forum software built for the modern web

fix: include fullnameEmoji in key places in core

Julian Lam873d0277c83a
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js
index a16e0e1f9f..2e6fe6a62f 100644
--- a/src/activitypub/mocks.js
+++ b/src/activitypub/mocks.js
@@ -251,7 +251,7 @@ Mocks.profile = async (actors) => {
bgColor = iconBackgrounds[bgColor % iconBackgrounds.length];
summary = await activitypub.helpers.renderEmoji(summary || '', tag);
- // Extract emoji metadata for fullname rendering (titleEmoji pattern)
+ // Extract emoji metadata for fullname rendering
const nameEmoji = [];
const emojiTags = (tag || []).filter(tag => tag.type === 'Emoji');
for (const emojiTag of emojiTags) {
diff --git a/src/posts/summary.js b/src/posts/summary.js
index 67b33dec51..75409759ae 100644
--- a/src/posts/summary.js
+++ b/src/posts/summary.js
@@ -34,7 +34,7 @@ module.exports = function (Posts) {
const tids = _.uniq(posts.map(p => p && p.tid));
const [users, topicsAndCategories] = await Promise.all([
- user.getUsersFields(uids, ['uid', 'username', 'userslug', 'picture', 'status']),
+ user.getUsersFields(uids, ['uid', 'username', 'userslug', 'picture', 'status', 'fullnameEmoji']),
getTopicAndCategories(tids),
]);
diff --git a/src/posts/user.js b/src/posts/user.js
index ef6e0ab266..326be845fa 100644
--- a/src/posts/user.js
+++ b/src/posts/user.js
@@ -96,7 +96,7 @@ module.exports = function (Posts) {
async function getUserData(uids, uid) {
const fields = [
- 'uid', 'username', 'fullname', 'userslug',
+ 'uid', 'username', 'fullname', 'fullnameEmoji', 'userslug',
'reputation', 'postcount', 'topiccount', 'picture',
'signature', 'banned', 'banned:expire', 'status',
'lastonline', 'groupTitle', 'muted', 'mutedUntil',
diff --git a/src/topics/index.js b/src/topics/index.js
index 8940a5b84a..01a6dc466c 100644
--- a/src/topics/index.js
+++ b/src/topics/index.js
@@ -101,7 +101,7 @@ Topics.getTopicsByTids = async function (tids, options) {
const [teasers, users, userSettings, categoriesData, guestHandles, thumbs] = await Promise.all([
Topics.getTeasers(topics, options),
- user.getUsersFields(uids, ['uid', 'username', 'fullname', 'userslug', 'reputation', 'postcount', 'picture', 'banned', 'status']),
+ user.getUsersFields(uids, ['uid', 'username', 'fullname', 'fullnameEmoji', 'userslug', 'reputation', 'postcount', 'picture', 'banned', 'status']),
loadShowfullnameSettings(),
categories.getCategoriesFields(cids, ['cid', 'name', 'slug', 'icon', 'backgroundImage', 'imageClass', 'bgColor', 'color', 'disabled']),
loadGuestHandles(),
diff --git a/src/topics/teaser.js b/src/topics/teaser.js
index 93405e4d6b..92073803ca 100644
--- a/src/topics/teaser.js
+++ b/src/topics/teaser.js
@@ -54,7 +54,7 @@ module.exports = function (Topics) {
postData = postData.filter(Boolean);
const uids = _.uniq(postData.map(post => post.uid));
const sortNewToOld = callerSettings.topicPostSort === 'newest_to_oldest';
- const usersData = await user.getUsersFields(uids, ['uid', 'username', 'userslug', 'picture']);
+ const usersData = await user.getUsersFields(uids, ['uid', 'username', 'userslug', 'picture', 'fullnameEmoji']);
const users = {};
usersData.forEach((user) => {
diff --git a/src/user/data.js b/src/user/data.js
index 11d81e56de..99749786d4 100644
--- a/src/user/data.js
+++ b/src/user/data.js
@@ -272,7 +272,7 @@ module.exports = function (User) {
db.parseIntFields(user, intFields, requestedFields);
- // Parse fullnameEmoji from JSON (titleEmoji pattern)
+ // Parse fullnameEmoji from JSON
if (user.hasOwnProperty('fullnameEmoji')) {
user.fullnameEmoji = user.fullnameEmoji ? JSON.parse(String(user.fullnameEmoji)) : [];
}
diff --git a/src/user/index.js b/src/user/index.js
index 73ce5c0775..bd25667f54 100644
--- a/src/user/index.js
+++ b/src/user/index.js
@@ -91,6 +91,7 @@ User.getUsers = async function (uids, uid) {
'uid', 'username', 'userslug', 'picture', 'status',
'postcount', 'reputation', 'email:confirmed', 'lastonline',
'flags', 'banned', 'banned:expire', 'joindate',
+ 'fullnameEmoji',
], uid);
return User.hidePrivateData(userData, uid);
diff --git a/src/views/partials/feed/item.tpl b/src/views/partials/feed/item.tpl
index b0800a99c7..e8e0a693cb 100644
--- a/src/views/partials/feed/item.tpl
+++ b/src/views/partials/feed/item.tpl
@@ -30,7 +30,7 @@
<div class="text-sm">
<div class="post-author d-flex align-items-center gap-1">
<a class="d-inline d-lg-none lh-1 text-decoration-none" href="{config.relative_path}/user/{./user.userslug}">{{buildAvatar(./user, "16px", true, "not-responsive")}}</a>
- <a class="lh-normal fw-semibold text-nowrap" href="{config.relative_path}/user/{./user.userslug}">{{txDisplayname(./user)}}</a>
+ <a class="lh-normal fw-semibold text-nowrap" href="{config.relative_path}/user/{./user.userslug}">{{renderShortcodeEmoji(txDisplayname(./user), ./user.fullnameEmoji)}}</a>
</div>
<span class="timeago text-muted lh-normal" title="{./timestampISO}"></span>
</div>