FEATURE: always show highest trust level badge in card
FEATURE: fa-user icon for trust level badges
This commit is contained in:
parent
b5c5c2fe37
commit
72a28aeb7c
|
@ -252,6 +252,10 @@ SQL
|
|||
!self.multiple_grant?
|
||||
end
|
||||
|
||||
def default_icon=(val)
|
||||
self.icon ||= val
|
||||
end
|
||||
|
||||
def default_name=(val)
|
||||
self.name ||= val
|
||||
end
|
||||
|
|
|
@ -511,6 +511,9 @@ class User < ActiveRecord::Base
|
|||
def featured_user_badges
|
||||
user_badges
|
||||
.joins(:badge)
|
||||
.order("CASE WHEN badges.id = (SELECT MAX(ub2.badge_id) FROM user_badges ub2
|
||||
WHERE ub2.badge_id IN (#{Badge.trust_level_badge_ids.join(",")}) AND
|
||||
ub2.user_id = #{self.id}) THEN 1 ELSE 0 END DESC")
|
||||
.order('badges.badge_type_id ASC, badges.grant_count ASC')
|
||||
.includes(:user, :granted_by, badge: :badge_type)
|
||||
.where("user_badges.id in (select min(u2.id)
|
||||
|
|
|
@ -56,6 +56,7 @@ trust_level_badges.each do |spec|
|
|||
|
||||
# allow title for tl3 and above
|
||||
b.default_allow_title = spec[:id] > 2
|
||||
b.default_icon = "fa-user"
|
||||
b.system = true
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue