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/helpers/user-status.js.es6

21 lines
671 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'));
let currentUser;
if (args && args.hash) {
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 }) });
}
});