diff options
-rw-r--r-- | app/helpers/statuses_helper.rb | 9 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/account/components/header.js | 19 |
2 files changed, 26 insertions, 2 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') diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index 553302cbc..8314ce109 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -226,7 +226,22 @@ class Header extends ImmutablePureComponent { <h1> <span dangerouslySetInnerHTML={displayNameHtml} /> <small>@{acct}</small> - <div className='roles'>{badge_admin}{badge_mod}{badge_halfmod}{badge_froze}{badge_locked}{badge_limited}{badge_ac}{badge_bot}{badge_gently}{badge_kobold}</div> + <div className='roles'> + {badge_admin} + {badge_mod} + {badge_halfmod} + {badge_froze} + {badge_locked} + {badge_limited} + {badge_ac} + {badge_bot} + {badge_gently} + {badge_kobold} + + {fields.filter(pair => pair.get('name') === 'badge').map((pair, i) => ( + <div key={50+i} className='account-role custom'><span dangerouslySetInnerHTML={{ __html: pair.get('value_emojified') }} /></div>) + )} + </div> </h1> </div> @@ -246,7 +261,7 @@ class Header extends ImmutablePureComponent { </dd> </dl> ))} - {fields.map((pair, i) => ( + {fields.filter(pair => pair.get('name') !== 'badge').map((pair, i) => ( <dl key={i}> <dt dangerouslySetInnerHTML={{ __html: pair.get('name_emojified') }} title={pair.get('name')} /> |