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 (#285)
* 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
- Loading branch information
Showing
6 changed files
with
114 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,7 @@ | ||
{ | ||
"tests": { | ||
"requiredPlugins": [ | ||
"https://github.com/discourse/discourse-assign" | ||
] | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/lib/plugin_initializers/assigned_reminder_exclude_solved.rb
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,30 @@ | ||
# 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 |
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
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