discourse/app/assets/javascripts/discourse/helpers/user-status.js.es6

18 lines
625 B
JavaScript

import { iconHTML } from 'discourse-common/helpers/fa-icon';
import { htmlHelper } from 'discourse-common/lib/helpers';
import { escapeExpression } from 'discourse/lib/utilities';
export default htmlHelper((user, args) => {
if (!user) { return; }
const name = escapeExpression(user.get('name'));
const currentUser = args.hash.currentUser;
if (currentUser && user.get('admin') && currentUser.get('staff')) {
return iconHTML('shield', { label: I18n.t('user.admin', { user: name }) });
}
if (user.get('moderator')) {
return iconHTML('shield', { label: I18n.t('user.moderator', { user: name }) });
}
});