discourse/app/serializers/post_action_user_serializer.rb
Robin Ward 4a2871f7f6
FEATURE: Don't display muted/ignored users under "who liked" (#10084)
* FEATURE: Don't display muted/ignored users under "who liked"

Previously, if you clicked on the heart icon below a post
it would show you the avatar for a user even if you ignored or muted
them.

This commit will instead display a (?) icon. The count of likes will
remain correct, but you needn't be reminded of the person you
preferred not to see.

* Use a circle instead of (?) for unknown user
2020-06-19 10:44:21 -04:00

37 lines
591 B
Ruby

# frozen_string_literal: true
class PostActionUserSerializer < BasicUserSerializer
attributes :post_url,
:username_lower,
:unknown
def id
object.user.id
end
def username
object.user.username
end
def username_lower
object.user.username_lower
end
def avatar_template
object.user.avatar_template
end
def post_url
object.related_post.url if object.related_post_id && object.related_post
end
def unknown
true
end
def include_unknown?
(@options[:unknown_user_ids] || []).include?(object.user.id)
end
end