mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
This reverts commit 5dda5c2f7c.
This commit is contained in:
@@ -31,8 +31,7 @@ class BasicGroupSerializer < ApplicationSerializer
|
||||
:is_group_user,
|
||||
:is_group_owner,
|
||||
:members_visibility_level,
|
||||
:can_see_members,
|
||||
:publish_read_state
|
||||
:can_see_members
|
||||
|
||||
def include_display_name?
|
||||
object.automatic
|
||||
|
||||
@@ -25,8 +25,7 @@ class ListableTopicSerializer < BasicTopicSerializer
|
||||
:notification_level,
|
||||
:bookmarked,
|
||||
:liked,
|
||||
:unicode_title,
|
||||
:read_by_group_member
|
||||
:unicode_title
|
||||
|
||||
has_one :last_poster, serializer: BasicUserSerializer, embed: :objects
|
||||
|
||||
@@ -122,18 +121,6 @@ class ListableTopicSerializer < BasicTopicSerializer
|
||||
PinnedCheck.unpinned?(object, object.user_data)
|
||||
end
|
||||
|
||||
def read_by_group_member
|
||||
# object#minimum_unread_count is a dynamically generated attribute.
|
||||
# See TopicQuery#append_read_state for more information.
|
||||
return false unless object.respond_to?(:minimum_unread_count)
|
||||
|
||||
object.minimum_unread_count && object.minimum_unread_count <= 0
|
||||
end
|
||||
|
||||
def include_read_by_group_member?
|
||||
!!object.topic_list&.publish_read_state
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def unread_helper
|
||||
|
||||
@@ -26,7 +26,6 @@ class PostSerializer < BasicPostSerializer
|
||||
:quote_count,
|
||||
:incoming_link_count,
|
||||
:reads,
|
||||
:readers_count,
|
||||
:score,
|
||||
:yours,
|
||||
:topic_id,
|
||||
@@ -459,13 +458,6 @@ class PostSerializer < BasicPostSerializer
|
||||
can_review_topic?
|
||||
end
|
||||
|
||||
def readers_count
|
||||
read_count = object.reads - 1 # Exclude logged user
|
||||
read_count -= 1 unless yours
|
||||
|
||||
read_count < 0 ? 0 : read_count
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def can_review_topic?
|
||||
|
||||
@@ -71,8 +71,7 @@ class TopicViewSerializer < ApplicationSerializer
|
||||
:participant_count,
|
||||
:destination_category_id,
|
||||
:pm_with_non_human_user,
|
||||
:queued_posts_count,
|
||||
:show_read_indicator
|
||||
:queued_posts_count
|
||||
)
|
||||
|
||||
has_one :details, serializer: TopicViewDetailsSerializer, root: false, embed: :objects
|
||||
@@ -249,8 +248,4 @@ class TopicViewSerializer < ApplicationSerializer
|
||||
def include_queued_posts_count?
|
||||
scope.is_staff? && object.queued_posts_enabled
|
||||
end
|
||||
|
||||
def show_read_indicator
|
||||
object.show_read_indicator?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,7 +32,4 @@ class WebHookPostSerializer < PostSerializer
|
||||
object.topic ? object.topic.posts_count : 0
|
||||
end
|
||||
|
||||
def include_readers_count?
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,10 +28,6 @@ class WebHookTopicViewSerializer < TopicViewSerializer
|
||||
end
|
||||
end
|
||||
|
||||
def include_show_read_indicator?
|
||||
false
|
||||
end
|
||||
|
||||
def created_by
|
||||
BasicUserSerializer.new(object.topic.user, scope: scope, root: false)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user