Revert "Only send can_have_answer attribute if empty_box_on_unsolved is true"
This reverts commit ea8c94681b
.
This commit is contained in:
parent
f17d8ca52e
commit
d8f0b310f7
|
@ -340,22 +340,18 @@ SQL
|
||||||
require_dependency 'topic_list_item_serializer'
|
require_dependency 'topic_list_item_serializer'
|
||||||
|
|
||||||
class ::TopicListItemSerializer
|
class ::TopicListItemSerializer
|
||||||
attributes :has_accepted_answer
|
attributes :has_accepted_answer, :can_have_answer
|
||||||
|
|
||||||
def has_accepted_answer
|
def has_accepted_answer
|
||||||
object.custom_fields["accepted_answer_post_id"] ? true : false
|
object.custom_fields["accepted_answer_post_id"] ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
if SiteSetting.empty_box_on_unsolved
|
|
||||||
attributes :can_have_answer
|
|
||||||
|
|
||||||
def can_have_answer
|
def can_have_answer
|
||||||
return true if SiteSetting.allow_solved_on_all_topics
|
return true if SiteSetting.allow_solved_on_all_topics
|
||||||
|
|
||||||
return scope.allow_accepted_answers_on_category?(object.category_id)
|
return scope.allow_accepted_answers_on_category?(object.category_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
TopicList.preloaded_custom_fields << "accepted_answer_post_id" if TopicList.respond_to? :preloaded_custom_fields
|
TopicList.preloaded_custom_fields << "accepted_answer_post_id" if TopicList.respond_to? :preloaded_custom_fields
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue