discourse/app/serializers/web_hook_topic_view_serializer.rb
Andrei Prigorshnev 0df6b0bc47
FIX: slow mode dialog doesn't remember Enabled Until value (#13076)
If reload a page after enabling slow mode and open the slow mode dialog again it would show a slow mode interval but wouldn't show Enabled Until value. This PR fixes it.
2021-05-21 18:13:14 +04:00

43 lines
809 B
Ruby

# frozen_string_literal: true
class WebHookTopicViewSerializer < TopicViewSerializer
attributes :created_by,
:last_poster
%i{
post_stream
timeline_lookup
pm_with_non_human_user
draft
draft_key
draft_sequence
message_bus_last_id
suggested_topics
has_summary
actions_summary
current_post_number
chunk_size
topic_timer
details
image_url
slow_mode_seconds
slow_mode_enabled_until
}.each do |attr|
define_method("include_#{attr}?") do
false
end
end
def include_show_read_indicator?
false
end
def created_by
BasicUserSerializer.new(object.topic.user, scope: scope, root: false)
end
def last_poster
BasicUserSerializer.new(object.topic.last_poster, scope: scope, root: false)
end
end