mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 18:41:07 +08:00
FEATURE: User page refactor
Re-organise user page so it is easier to find interesting info split it into tabs - Introduce notifications and messages tabs - Stop couting stuff for the user page to speed up rendering - Suppress more information when viewing your own profile
This commit is contained in:
@ -70,7 +70,7 @@ class UserSerializer < BasicUserSerializer
|
||||
:automatically_unpin_topics
|
||||
|
||||
has_one :invited_by, embed: :object, serializer: BasicUserSerializer
|
||||
has_many :custom_groups, embed: :object, serializer: BasicGroupSerializer
|
||||
has_many :groups, embed: :object, serializer: BasicGroupSerializer
|
||||
has_many :featured_user_badges, embed: :ids, serializer: UserBadgeSerializer, root: :user_badges
|
||||
has_one :card_badge, embed: :object, serializer: BadgeSerializer
|
||||
|
||||
@ -118,6 +118,14 @@ class UserSerializer < BasicUserSerializer
|
||||
### ATTRIBUTES
|
||||
###
|
||||
|
||||
def groups
|
||||
if scope.is_admin? || object.id == scope.user.try(:id)
|
||||
object.groups
|
||||
else
|
||||
object.groups.where(visible: true)
|
||||
end
|
||||
end
|
||||
|
||||
def include_email?
|
||||
object.id && object.id == scope.user.try(:id)
|
||||
end
|
||||
|
Reference in New Issue
Block a user