mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: active webhook types exclude inactive plugins (#26022)
Bug introduced when webhooks were granularized in this PR - c468110929
Only active webhooks should be available when webhooks is configured.
https://meta.discourse.org/t/i18n-keys-showing-on-webhooks-edit-page/297701
This commit is contained in:
committed by
GitHub
parent
447ed2c06c
commit
28af4031ae
@@ -98,16 +98,23 @@ class WebHookEventType < ActiveRecord::Base
|
||||
def self.active
|
||||
ids_to_exclude = []
|
||||
unless defined?(SiteSetting.solved_enabled) && SiteSetting.solved_enabled
|
||||
ids_to_exclude << TYPES[:solved_accept_unaccept]
|
||||
ids_to_exclude.concat([TYPES[:solved_accepted_solution], TYPES[:solved_unaccepted_solution]])
|
||||
end
|
||||
unless defined?(SiteSetting.assign_enabled) && SiteSetting.assign_enabled
|
||||
ids_to_exclude << TYPES[:assign_assign_unassign]
|
||||
ids_to_exclude.concat([TYPES[:assign_assigned], TYPES[:assign_unassigned]])
|
||||
end
|
||||
unless defined?(SiteSetting.voting_enabled) && SiteSetting.voting_enabled
|
||||
ids_to_exclude << TYPES[:voting_voted_unvoted]
|
||||
ids_to_exclude.concat([TYPES[:voting_topic_upvote], TYPES[:voting_topic_unvote]])
|
||||
end
|
||||
unless defined?(SiteSetting.chat_enabled) && SiteSetting.chat_enabled
|
||||
ids_to_exclude << TYPES[:chat_message]
|
||||
ids_to_exclude.concat(
|
||||
[
|
||||
TYPES[:chat_message_created],
|
||||
TYPES[:chat_message_edited],
|
||||
TYPES[:chat_message_trashed],
|
||||
TYPES[:chat_message_restored],
|
||||
],
|
||||
)
|
||||
end
|
||||
self.where.not(id: ids_to_exclude)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user