Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
98f7e71a
Commit
98f7e71a
authored
Oct 16, 2019
by
manojmj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use cascading deletes for deleting logs upon deleting a webhook
parent
142bf826
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
app/models/hooks/web_hook.rb
app/models/hooks/web_hook.rb
+1
-1
changelogs/unreleased/29215-500-error-when-deleting-group-web-hook-activerecord-statementinvali.yml
...-deleting-group-web-hook-activerecord-statementinvali.yml
+5
-0
spec/models/hooks/web_hook_spec.rb
spec/models/hooks/web_hook_spec.rb
+10
-1
No files found.
app/models/hooks/web_hook.rb
View file @
98f7e71a
...
...
@@ -13,7 +13,7 @@ class WebHook < ApplicationRecord
algorithm:
'aes-256-gcm'
,
key:
Settings
.
attr_encrypted_db_key_base_32
has_many
:web_hook_logs
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:web_hook_logs
validates
:url
,
presence:
true
validates
:url
,
public_url:
true
,
unless:
->
(
hook
)
{
hook
.
is_a?
(
SystemHook
)
}
...
...
changelogs/unreleased/29215-500-error-when-deleting-group-web-hook-activerecord-statementinvali.yml
0 → 100644
View file @
98f7e71a
---
title
:
Use cascading deletes for deleting logs upon deleting a webhook
merge_request
:
18642
author
:
type
:
performance
spec/models/hooks/web_hook_spec.rb
View file @
98f7e71a
...
...
@@ -6,7 +6,7 @@ describe WebHook do
let
(
:hook
)
{
build
(
:project_hook
)
}
describe
'associations'
do
it
{
is_expected
.
to
have_many
(
:web_hook_logs
)
.
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:web_hook_logs
)
}
end
describe
'validations'
do
...
...
@@ -85,4 +85,13 @@ describe WebHook do
hook
.
async_execute
(
data
,
hook_name
)
end
end
describe
'#destroy'
do
it
'cascades to web_hook_logs'
do
web_hook
=
create
(
:project_hook
)
create_list
(
:web_hook_log
,
3
,
web_hook:
web_hook
)
expect
{
web_hook
.
destroy
}.
to
change
(
web_hook
.
web_hook_logs
,
:count
).
by
(
-
3
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment