framework/js/lib/helpers/username.js
2015-10-02 16:37:09 +09:00

13 lines
396 B
JavaScript

/**
* The `username` helper displays a user's username in a <span class="username">
* tag. If the user doesn't exist, the username will be displayed as [deleted].
*
* @param {User} user
* @return {Object}
*/
export default function username(user) {
const name = (user && user.username()) || app.trans('core.forum.user_deleted_text');
return <span className="username">{name}</span>;
}