Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 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 AssignsRemainderForTopicsQuery < PluginInitializer | ||
def apply_plugin_api | ||
plugin.register_modifier(:assigns_reminder_assigned_topics_query) do |query| | ||
next query if !SiteSetting.prevent_assign_notification | ||
query.where( | ||
"topics.id NOT IN ( | ||
SELECT topic_id | ||
FROM topic_custom_fields | ||
WHERE name = 'accepted_answer_post_id' | ||
)", | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters