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
b5f388cc
Commit
b5f388cc
authored
Jan 04, 2019
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor code around transaction
Extract transaction
parent
d79b7d3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
ee/lib/gitlab/background_migration/migrate_approver_to_approval_rules.rb
...ackground_migration/migrate_approver_to_approval_rules.rb
+12
-14
No files found.
ee/lib/gitlab/background_migration/migrate_approver_to_approval_rules.rb
View file @
b5f388cc
...
@@ -98,30 +98,28 @@ module Gitlab
...
@@ -98,30 +98,28 @@ module Gitlab
raise
"Incorrect target_type
#{
target_type
}
"
unless
ALLOWED_TARGET_TYPES
.
include?
(
@target_type
)
raise
"Incorrect target_type
#{
target_type
}
"
unless
ALLOWED_TARGET_TYPES
.
include?
(
@target_type
)
case
target
ActiveRecord
::
Base
.
transaction
do
when
MergeRequest
case
target
handle_merge_request
when
MergeRequest
when
Project
handle_merge_request
handle_project
when
Project
handle_project
end
end
end
end
end
private
private
def
handle_merge_request
def
handle_merge_request
ActiveRecord
::
Base
.
transaction
do
if
rule
=
sync_rule
if
rule
=
sync_rule
rule
.
approval_project_rule
=
target
.
target_project
.
approval_rules
.
regular
.
first
rule
.
approval_project_rule
=
target
.
target_project
.
approval_rules
.
regular
.
first
end
target
.
sync_code_owners_with_approvers
end
end
target
.
sync_code_owners_with_approvers
end
end
def
handle_project
def
handle_project
ActiveRecord
::
Base
.
transaction
do
sync_rule
sync_rule
end
end
end
def
sync_rule
def
sync_rule
...
...
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