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
17b65a0e
Commit
17b65a0e
authored
Dec 17, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce diff with CE in Projects::ImportsController
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
1aab689d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
app/controllers/projects/imports_controller.rb
app/controllers/projects/imports_controller.rb
+7
-8
ee/app/controllers/ee/projects/imports_controller.rb
ee/app/controllers/ee/projects/imports_controller.rb
+29
-0
No files found.
app/controllers/projects/imports_controller.rb
View file @
17b65a0e
...
...
@@ -2,7 +2,6 @@
class
Projects::ImportsController
<
Projects
::
ApplicationController
include
ContinueParams
include
SafeMirrorParams
# Authorize
before_action
:authorize_admin_project!
...
...
@@ -14,7 +13,7 @@ class Projects::ImportsController < Projects::ApplicationController
end
def
create
if
@project
.
update
(
safe_
import_params
)
if
@project
.
update
(
import_params
)
@project
.
import_state
.
reload
.
schedule
end
...
...
@@ -67,13 +66,13 @@ class Projects::ImportsController < Projects::ApplicationController
end
end
def
import_params
params
.
require
(
:project
).
permit
(
:import_url
,
:mirror
,
:mirror_user_id
)
def
import_params
_attributes
[
:import_url
]
end
def
safe_import_params
return
import_params
if
valid_mirror_user?
(
import_params
)
import_params
.
merge
(
mirror_user_id:
current_user
.
id
)
def
import_params
params
.
require
(
:project
).
permit
(
import_params_attributes
)
end
end
Projects
::
ImportsController
.
prepend
(
::
EE
::
Projects
::
ImportsController
)
ee/app/controllers/ee/projects/imports_controller.rb
0 → 100644
View file @
17b65a0e
# frozen_string_literal: true
module
EE
module
Projects
module
ImportsController
extend
ActiveSupport
::
Concern
extend
::
Gitlab
::
Utils
::
Override
prepended
do
include
SafeMirrorParams
end
private
override
:import_params_attributes
def
import_params_attributes
super
+
[
:mirror
,
:mirror_user_id
]
end
override
:import_params
def
import_params
base_import_params
=
super
return
base_import_params
if
valid_mirror_user?
(
base_import_params
)
base_import_params
.
merge
(
mirror_user_id:
current_user
.
id
)
end
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