discourse-solved/app/lib/accepted_answer_cache.rb
Martin Brennan 444dac8a9a
DEV: Change accept_all_solutions_trust_level to group setting (#276)
This refactor makes for easier testing and makes things
more organised, the guardian extensions had no testing
whatsoever and I need some to make the TL -> group change.
2024-01-23 11:45:32 +10:00

23 lines
545 B
Ruby

# frozen_string_literal: true
module DiscourseSolved
class AcceptedAnswerCache
@@allowed_accepted_cache = DistributedCache.new("allowed_accepted")
def self.reset_accepted_answer_cache
@@allowed_accepted_cache["allowed"] = begin
Set.new(
CategoryCustomField.where(
name: ::DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD,
value: "true",
).pluck(:category_id),
)
end
end
def self.allowed
@@allowed_accepted_cache["allowed"]
end
end
end