Commit 428c5947 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'sh-fix-group-hooks' into 'master'

Fix group hooks not firing in PostReceive

Closes #13752

See merge request gitlab-org/gitlab-ee!15598
parents 97c047b7 d4cdff14
......@@ -279,6 +279,17 @@ module EE
end
end
override :has_active_hooks?
def has_active_hooks?(hooks_scope = :push_hooks)
super || has_group_hooks?(hooks_scope)
end
def has_group_hooks?(hooks_scope = :push_hooks)
return unless group && feature_available?(:group_webhooks)
group.hooks.hooks_for(hooks_scope).any?
end
def execute_hooks(data, hooks_scope = :push_hooks)
super
......
---
title: Fix group hooks not firing in PostReceive
merge_request: 15598
author:
type: fixed
......@@ -316,6 +316,30 @@ describe Project do
end
end
describe '#has_active_hooks?' do
context "with group hooks" do
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
let!(:group_hook) { create(:group_hook, group: group, push_events: true) }
before do
stub_licensed_features(group_webhooks: true)
end
it 'returns true' do
expect(project.has_active_hooks?).to be_truthy
expect(project.has_group_hooks?).to be_truthy
end
end
context 'with no group hooks' do
it 'returns false' do
expect(project.has_active_hooks?).to be_falsey
expect(project.has_group_hooks?).to be_falsey
end
end
end
describe "#execute_hooks" do
context "group hooks" do
let(:group) { create(:group) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment