FIX: Pass `siteSettings` through in more places
This commit is contained in:
parent
f8aa304c7d
commit
808b5aa5ba
|
@ -340,7 +340,8 @@ const Report = EmberObject.extend({
|
|||
|
||||
const avatarImg = renderAvatar(user, {
|
||||
imageSize: "tiny",
|
||||
ignoreTitle: true
|
||||
ignoreTitle: true,
|
||||
siteSettings: this.siteSettings
|
||||
});
|
||||
|
||||
return `<a href='${href}'>${avatarImg}<span class='username'>${user.name}</span></a>`;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue