mirror of
https://github.com/discourse/discourse-solved.git
synced 2025-05-09 18:07:33 +00:00
This commit autoloads plugin files, and also extracts features into their own modules. - `plugin.rb` is smaller - external plugins like discourse-automation and discourse-assign have their own entrypoints - solved filters as well
23 lines
545 B
Ruby
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
|