31 lines
756 B
Ruby
31 lines
756 B
Ruby
|
# 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
|