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
5bd6b44d
Commit
5bd6b44d
authored
Jan 07, 2019
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor find rule
Do no force a find by the name
parent
a818d996
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
ee/lib/gitlab/background_migration/migrate_approver_to_approval_rules.rb
...ackground_migration/migrate_approver_to_approval_rules.rb
+5
-5
No files found.
ee/lib/gitlab/background_migration/migrate_approver_to_approval_rules.rb
View file @
5bd6b44d
...
...
@@ -130,9 +130,8 @@ module Gitlab
return
end
rule
=
find_or_create_rule
rule
.
user_ids
=
target
.
approver_ids
rule
.
group_ids
=
target
.
approver_group_ids
rule
=
first_or_initialize
rule
.
update
(
user_ids:
target
.
approver_ids
,
group_ids:
target
.
approver_group_ids
)
rule
end
...
...
@@ -147,10 +146,11 @@ module Gitlab
end
end
def
fi
nd_or_create_rul
e
rule
=
target
.
approval_rules
.
regular
.
fi
nd_or_initialize_by
(
name:
ApprovalRuleLike
::
DEFAULT_NAME
)
def
fi
rst_or_initializ
e
rule
=
target
.
approval_rules
.
regular
.
fi
rst_or_initialize
unless
rule
.
persisted?
rule
.
name
||=
ApprovalRuleLike
::
DEFAULT_NAME
rule
.
approvals_required
=
target
.
approvals_before_merge
||
0
rule
.
save!
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