mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 18:28:34 +08:00
f05da14fb6
These accidental inclusions are mostly no-ops (because the method name is also included as an explicit symbol). The mistakes were made more obvious because syntax_tree adjusted the indentation of these methods
67 lines
1.1 KiB
Ruby
67 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class TopicPostCountSerializer < BasicUserSerializer
|
|
attributes :post_count,
|
|
:primary_group_name,
|
|
:flair_name,
|
|
:flair_url,
|
|
:flair_color,
|
|
:flair_bg_color,
|
|
:admin,
|
|
:moderator,
|
|
:trust_level
|
|
|
|
def id
|
|
object[:user].id
|
|
end
|
|
|
|
def username
|
|
object[:user].username
|
|
end
|
|
|
|
def post_count
|
|
object[:post_count]
|
|
end
|
|
|
|
def primary_group_name
|
|
return nil unless object[:user].primary_group_id
|
|
object[:user]&.primary_group&.name
|
|
end
|
|
|
|
def flair_name
|
|
object[:user]&.flair_group&.name
|
|
end
|
|
|
|
def flair_url
|
|
object[:user]&.flair_group&.flair_url
|
|
end
|
|
|
|
def flair_bg_color
|
|
object[:user]&.flair_group&.flair_bg_color
|
|
end
|
|
|
|
def flair_color
|
|
object[:user]&.flair_group&.flair_color
|
|
end
|
|
|
|
def include_admin?
|
|
object[:user].admin
|
|
end
|
|
|
|
def admin
|
|
true
|
|
end
|
|
|
|
def include_moderator?
|
|
object[:user].moderator
|
|
end
|
|
|
|
def moderator
|
|
true
|
|
end
|
|
|
|
def trust_level
|
|
object[:user].trust_level
|
|
end
|
|
end
|