mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: show user what badges they have
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
class BadgeSerializer < ApplicationSerializer
|
||||
attributes :id, :name, :description, :grant_count, :allow_title, :multiple_grant, :icon, :listable, :enabled
|
||||
|
||||
attributes :id, :name, :description, :grant_count, :allow_title, :multiple_grant, :icon, :listable, :enabled, :has_badge
|
||||
has_one :badge_type
|
||||
|
||||
def include_has_badge?
|
||||
@options[:user_badges]
|
||||
end
|
||||
|
||||
def has_badge
|
||||
@options[:user_badges].include?(object.id)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user