2024-04-26 18:21:09 +02:00
|
|
|
# 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
|
2024-09-05 17:55:02 +08:00
|
|
|
query.where.not(id: DiscourseSolved::Solution.pluck(:topic_id))
|
2024-04-26 18:21:09 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|