mirror of
https://github.com/discourse/discourse.git
synced 2025-09-10 08:38:11 +08:00
FIX: Don't display webhooks for inactive plugins (#9206)
* FIX: Don't display webhooks for inactive plugins This commit ensures that we don't show webhooks for plugins that are not installed or that are disabled. Bug report: https://meta.discourse.org/t/webhookeventtype-and-the-solved-and-assign-plugins/144180 * rename to just 'active', it's cleaner
This commit is contained in:
parent
e950471c0f
commit
919e405c48
3 changed files with 26 additions and 1 deletions
|
@ -44,6 +44,22 @@ describe WebHook do
|
|||
expect(post_hook.payload_url).to eq("https://example.com")
|
||||
end
|
||||
|
||||
it "excludes disabled plugin web_hooks" do
|
||||
web_hook_event_types = WebHookEventType.active.find_by(name: 'solved')
|
||||
expect(web_hook_event_types).to eq(nil)
|
||||
end
|
||||
|
||||
it "includes non-plugin web_hooks" do
|
||||
web_hook_event_types = WebHookEventType.active.where(name: 'topic')
|
||||
expect(web_hook_event_types.count).to eq(1)
|
||||
end
|
||||
|
||||
it "includes enabled plugin web_hooks" do
|
||||
SiteSetting.stubs(:solved_enabled).returns(true)
|
||||
web_hook_event_types = WebHookEventType.active.where(name: 'solved')
|
||||
expect(web_hook_event_types.count).to eq(1)
|
||||
end
|
||||
|
||||
describe '#active_web_hooks' do
|
||||
it "returns unique hooks" do
|
||||
post_hook.web_hook_event_types << WebHookEventType.find_by(name: 'topic')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue