discourse-solved/app/lib/plugin_initializers/assigned_reminder_exclude_s...

31 lines
756 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module DiscourseSolved
class PluginInitializer
attr_reader :plugin
def initialize(plugin)
@plugin = plugin
end
def apply_plugin_api
# this method should be overridden by subclasses
raise NotImplementedError
end
end
class AssignsReminderForTopicsQuery < PluginInitializer
def apply_plugin_api
plugin.register_modifier(:assigns_reminder_assigned_topics_query) do |query|
next query if !SiteSetting.ignore_solved_topics_in_assigned_reminder
query.where.not(
id:
TopicCustomField.where(
name: ::DiscourseSolved::ACCEPTED_ANSWER_POST_ID_CUSTOM_FIELD,
).pluck(:topic_id),
)
end
end
end
end