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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
d0546e6d
Commit
d0546e6d
authored
Oct 24, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uypdated keys controller logic
parent
72b7b10d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
8 deletions
+3
-8
app/controllers/profiles/keys_controller.rb
app/controllers/profiles/keys_controller.rb
+2
-8
app/services/keys/base_service.rb
app/services/keys/base_service.rb
+1
-0
No files found.
app/controllers/profiles/keys_controller.rb
View file @
d0546e6d
...
@@ -11,10 +11,10 @@ class Profiles::KeysController < Profiles::ApplicationController
...
@@ -11,10 +11,10 @@ class Profiles::KeysController < Profiles::ApplicationController
end
end
def
create
def
create
@key
=
Keys
::
CreateService
.
new
(
current_user
,
key_params
).
execute
@key
=
Keys
::
CreateService
.
new
(
current_user
,
key_params
.
merge
(
ip_address:
request
.
remote_ip
)
).
execute
if
@key
.
persisted?
if
@key
.
persisted?
redirect_to
_profile_key_path
redirect_to
profile_key_path
(
@key
)
else
else
@keys
=
current_user
.
keys
.
select
(
&
:persisted?
)
@keys
=
current_user
.
keys
.
select
(
&
:persisted?
)
render
:index
render
:index
...
@@ -50,12 +50,6 @@ class Profiles::KeysController < Profiles::ApplicationController
...
@@ -50,12 +50,6 @@ class Profiles::KeysController < Profiles::ApplicationController
end
end
end
end
protected
def
redirect_to_profile_key_path
redirect_to
profile_key_path
(
@key
)
end
private
private
def
key_params
def
key_params
...
...
app/services/keys/base_service.rb
View file @
d0546e6d
...
@@ -4,6 +4,7 @@ module Keys
...
@@ -4,6 +4,7 @@ module Keys
def
initialize
(
user
,
params
)
def
initialize
(
user
,
params
)
@user
,
@params
=
user
,
params
@user
,
@params
=
user
,
params
@ip_address
=
@params
.
delete
(
:ip_address
)
end
end
def
notification_service
def
notification_service
...
...
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