about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-02-22 01:05:20 -0600
committermultiple creatures <dev@multiple-creature.party>2020-02-22 01:05:20 -0600
commite51cf7e2b9eb8ef1ee9ac2da08442a513696b3eb (patch)
treeeff7180a1a8f544f311cac9467212d7eaa8874bc /app/helpers
parentc32c3f70cdf4e9f113d24e2d9b875fe7052bc839 (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.rb9
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')