This repository has been archived on 2023-03-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
osr-discourse-src/app/assets/javascripts/discourse/components/about-page-users.js.es6
T
Robin Ward a8a76198b1 REFACTOR: Remove Ember.Component global variable
Use imports instead.
2019-10-23 12:30:52 -04:00

26 lines
853 B
JavaScript

import Component from "@ember/component";
import { userPath } from "discourse/lib/url";
import { formatUsername, escapeExpression } from "discourse/lib/utilities";
import { normalize } from "discourse/components/user-info";
import { renderAvatar } from "discourse/helpers/user-avatar";
export default Component.extend({
usersTemplates: Ember.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: escapeExpression(user.title || ""),
formatedUsername: formatUsername(user.username)
};
});
})
});