This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/about-page-users.js.es6
Vinoth Kannan da2b0b2882 UX: remove the double-encoding of user titles.
`{{}}` in handlebars are already escaping the HTML elements.
2019-12-06 04:07:47 +05:30

27 lines
853 B
JavaScript

import Component from "@ember/component";
import { userPath } from "discourse/lib/url";
import { formatUsername } from "discourse/lib/utilities";
import { normalize } from "discourse/components/user-info";
import { renderAvatar } from "discourse/helpers/user-avatar";
import { computed } from "@ember/object";
export default Component.extend({
usersTemplates: computed("users.[]", function() {
return (this.users || []).map(user => {
let name = "";
if (user.name && normalize(user.username) !== normalize(user.name)) {
name = user.name;
}
return {
username: user.username,
name,
userPath: userPath(user.username),
avatar: renderAvatar(user, { imageSize: "large" }),
title: user.title || "",
formatedUsername: formatUsername(user.username)
};
});
})
});