mirror of
https://github.com/discourse/discourse-solved.git
synced 2026-09-17 23:12:13 -04:00
This PR does some preparatory work to prepare for the front-end display of who marked an answer as solved. It migrates the custom fields from discourse-solved of Topic and Post to a new table, except "accepted_answer_post_id" ref: /t/-/95318
26 lines
634 B
Ruby
26 lines
634 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: DiscourseSolved::Solution.pluck(:topic_id))
|
|
end
|
|
end
|
|
end
|
|
end
|