FIX: Include the serializer fields only if plugin is enabled

FIX: Include the serializer fields only if plugin is enabled

diff --git a/app/serializers/concerns/topic_answer_mixin.rb b/app/serializers/concerns/topic_answer_mixin.rb
index 23c8a22..a767ab9 100644
--- a/app/serializers/concerns/topic_answer_mixin.rb
+++ b/app/serializers/concerns/topic_answer_mixin.rb
@@ -7,6 +7,10 @@ module TopicAnswerMixin
     object.custom_fields["accepted_answer_post_id"] ? true : false
   end
 
+  def include_has_accepted_answer?
+    SiteSetting.solved_enabled
+  end
+
   def can_have_answer
     return true if SiteSetting.allow_solved_on_all_topics
     return false if object.closed || object.archived
@@ -14,6 +18,6 @@ module TopicAnswerMixin
   end
 
   def include_can_have_answer?
-    SiteSetting.empty_box_on_unsolved
+    SiteSetting.solved_enabled && SiteSetting.empty_box_on_unsolved
   end
 end

GitHub sha: d0cf9c25

1 Like