discourse-follow/app/serializers/follow_post_serializer.rb
Gabriel Grubba ba882c8a2f
SECURITY: Follow post excerpts are shown for hidden posts (#184)
Backport adaptation for d-compat/2026.4: this Discourse release predates
Guardian#filter_hidden_posts (discourse/discourse#40217), so the hidden-post
filtering is replicated locally in UserFollower using the same visibility
rules as Guardian#can_see_hidden_post? on this release.
2026-06-15 12:25:25 -03:00

18 lines
426 B
Ruby

# frozen_string_literal: true
class FollowPostSerializer < ApplicationSerializer
include PostItemExcerpt
attributes *%i[category_id created_at id post_number post_type topic_id url]
has_one :user, serializer: BasicUserSerializer, embed: :object
has_one :topic, serializer: BasicTopicSerializer, embed: :object
def post_item_excerpt_post
object
end
def category_id
object.topic.category_id
end
end