This commit is contained in:
Nat 2025-03-21 11:38:46 +08:00
parent e128adec9d
commit 86429400f5
No known key found for this signature in database
GPG Key ID: 4938B35D927EC773
2 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
module ::DiscourseSolved
module DiscourseSolved
module TopicAnswerMixin
def self.included(klass)
klass.attributes :has_accepted_answer, :can_have_answer

View File

@ -17,13 +17,13 @@ module DiscourseSolved
end
unsolved_callback = ->(scope) do
scope = scope.where <<~SQL
topics.id NOT IN (
SELECT topic_id
FROM topic_custom_fields
WHERE name = '#{::DiscourseSolved::ACCEPTED_ANSWER_POST_ID_CUSTOM_FIELD}'
AND value IS NOT NULL
)
SQL
topics.id NOT IN (
SELECT topic_id
FROM topic_custom_fields
WHERE name = '#{::DiscourseSolved::ACCEPTED_ANSWER_POST_ID_CUSTOM_FIELD}'
AND value IS NOT NULL
)
SQL
if !SiteSetting.allow_solved_on_all_topics
tag_ids = Tag.where(name: SiteSetting.enable_solved_tags.split("|")).pluck(:id)