diff --git a/app/assets/javascripts/admin/models/report.js b/app/assets/javascripts/admin/models/report.js index 9d2f25f9a1d..8475a26a95b 100644 --- a/app/assets/javascripts/admin/models/report.js +++ b/app/assets/javascripts/admin/models/report.js @@ -340,7 +340,8 @@ const Report = EmberObject.extend({ const avatarImg = renderAvatar(user, { imageSize: "tiny", - ignoreTitle: true + ignoreTitle: true, + siteSettings: this.siteSettings }); return `${avatarImg}${user.name}`; diff --git a/app/assets/javascripts/discourse/app/components/about-page-users.js b/app/assets/javascripts/discourse/app/components/about-page-users.js index ce2589491dd..87d8bcfd567 100644 --- a/app/assets/javascripts/discourse/app/components/about-page-users.js +++ b/app/assets/javascripts/discourse/app/components/about-page-users.js @@ -21,7 +21,10 @@ export default Component.extend({ name, username, userPath: userPath(username), - avatar: renderAvatar(user, { imageSize: "large" }), + avatar: renderAvatar(user, { + imageSize: "large", + siteSettings: this.siteSettings + }), title: user.title || "", formatedUsername: formatUsername(username), prioritizeName, diff --git a/app/assets/javascripts/discourse/app/helpers/user-avatar.js b/app/assets/javascripts/discourse/app/helpers/user-avatar.js index 0421799eceb..7624ce73b60 100644 --- a/app/assets/javascripts/discourse/app/helpers/user-avatar.js +++ b/app/assets/javascripts/discourse/app/helpers/user-avatar.js @@ -1,5 +1,5 @@ import { get } from "@ember/object"; -import { registerUnbound } from "discourse-common/lib/helpers"; +import { registerUnbound, helperContext } from "discourse-common/lib/helpers"; import { avatarImg, formatUsername } from "discourse/lib/utilities"; import { prioritizeNameInUx } from "discourse/lib/settings"; import { htmlSafe } from "@ember/template"; @@ -32,6 +32,7 @@ export function classesForUser(u) { function renderAvatar(user, options) { options = options || {}; + let siteSettings = helperContext().siteSettings; if (user) { const name = get(user, options.namePath || "name"); const username = get(user, options.usernamePath || "username"); @@ -44,7 +45,7 @@ function renderAvatar(user, options) { return ""; } - let displayName = prioritizeNameInUx(name) + let displayName = prioritizeNameInUx(name, siteSettings) ? name : formatUsername(username); diff --git a/app/assets/javascripts/discourse/app/widgets/post.js b/app/assets/javascripts/discourse/app/widgets/post.js index 93f988f7930..679f0720c57 100644 --- a/app/assets/javascripts/discourse/app/widgets/post.js +++ b/app/assets/javascripts/discourse/app/widgets/post.js @@ -479,7 +479,8 @@ createWidget("post-notice", { html(attrs) { const user = - this.siteSettings.display_name_on_posts && prioritizeNameInUx(attrs.name) + this.siteSettings.display_name_on_posts && + prioritizeNameInUx(attrs.name, this.siteSettings) ? attrs.name : attrs.username; let text, icon;