mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:38:32 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
36 lines
578 B
Ruby
36 lines
578 B
Ruby
# frozen_string_literal: true
|
|
|
|
class WebHookPostSerializer < PostSerializer
|
|
|
|
attributes :topic_posts_count
|
|
|
|
def include_topic_title?
|
|
true
|
|
end
|
|
|
|
%i{
|
|
can_view
|
|
can_edit
|
|
can_delete
|
|
can_recover
|
|
can_wiki
|
|
actions_summary
|
|
can_view_edit_history
|
|
yours
|
|
primary_group_flair_url
|
|
primary_group_flair_bg_color
|
|
primary_group_flair_color
|
|
notice_args
|
|
notice_type
|
|
}.each do |attr|
|
|
define_method("include_#{attr}?") do
|
|
false
|
|
end
|
|
end
|
|
|
|
def topic_posts_count
|
|
object.topic ? object.topic.posts_count : 0
|
|
end
|
|
|
|
end
|