mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 16:33:59 +08:00
18 lines
625 B
JavaScript
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 }) });
|
|
}
|
|
});
|