mirror of
https://github.com/discourse/discourse-solved.git
synced 2025-03-09 14:37:15 +00:00
* FEATURE: Prevents assign notification & change status on solved Relates to this [topic](https://meta.discourse.org/t/assign-plugin-for-informatica/256974/94) Add an event listener to `accepted_solution` event Add `assigns_reminder_assigned_topics_query` modifier to not notify if `prevent_assign_notification` setting is on. Add settings to prevent assign notification and change status on solved * DEV: Address review comments Update SiteSettings names. * DEV(WIP): Add tests for integration with discourse-assign Add test for integration with discourse-assign plugin checks if the assignment status is moved to `Done` * DEV: lint solved_spec.rb * DEV: Update test where it updates all assignments Change `on(:accepted_solution)` is defined Update test to use acting_user instead of admin * DEV: lint & add tests for assigns_reminder_assigned_topics_query Linted and added tests for `assigns_reminder_assigned_topics_query` modifier. * DEV: Update tests based on review feedback change plugin_initializer location update spec with new tests to test integration with discourse-assign * DEV: Add describe to spec for discourse-assign integration tests * DEV: update describe name for discourse-assing spec integration * DEV: Add more tests to spec for discourse-assign integration * DEV: Lint solved_spec * DEV: Lint and update spec to not have `p1` topic inside
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
|