diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-02-22 01:05:20 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-02-22 01:05:20 -0600 |
commit | e51cf7e2b9eb8ef1ee9ac2da08442a513696b3eb (patch) | |
tree | eff7180a1a8f544f311cac9467212d7eaa8874bc /app/helpers | |
parent | c32c3f70cdf4e9f113d24e2d9b875fe7052bc839 (diff) |
treat profile metadata fields with a `badge` label as custom profile badges
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/statuses_helper.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/statuses_helper.rb b/app/helpers/statuses_helper.rb index 574b3ad5c..66f17d939 100644 --- a/app/helpers/statuses_helper.rb +++ b/app/helpers/statuses_helper.rb @@ -56,6 +56,15 @@ module StatusesHelper roles << content_tag(:div, t('accounts.roles.gently'), class: 'account-role gently') if account.gently? roles << content_tag(:div, t('accounts.roles.kobold'), class: 'account-role kobold') if account.kobold? + user_badges = account.fields + .select { |field| field.name == 'badge' && !field.value&.strip.blank? } + .map { |field| field.value.strip } + .uniq + + roles |= user_badges.map do |field| + content_tag(:div, badge_text, class: 'account-role custom') + end + if (Setting.show_staff_badge && account.user_can_moderate?) || all if all && !account.user_staff? roles << content_tag(:div, t('admin.accounts.roles.user'), class: 'account-role') |