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
Jérome Perrin
gitlab-ce
Commits
e0d2f249
Commit
e0d2f249
authored
Mar 23, 2017
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return 404 if deploy key cannot be found in Projects::DeployKeysController#disable
Closes #29633
parent
d576fd82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
app/controllers/projects/deploy_keys_controller.rb
app/controllers/projects/deploy_keys_controller.rb
+3
-1
spec/features/projects/deploy_keys_spec.rb
spec/features/projects/deploy_keys_spec.rb
+26
-0
No files found.
app/controllers/projects/deploy_keys_controller.rb
View file @
e0d2f249
...
@@ -31,8 +31,10 @@ class Projects::DeployKeysController < Projects::ApplicationController
...
@@ -31,8 +31,10 @@ class Projects::DeployKeysController < Projects::ApplicationController
end
end
def
disable
def
disable
@project
.
deploy_keys_projects
.
find_by
(
deploy_key_id:
params
[
:id
]).
destroy
deploy_key_project
=
@project
.
deploy_keys_projects
.
find_by
(
deploy_key_id:
params
[
:id
])
return
render_404
unless
deploy_key_project
deploy_key_project
.
destroy!
redirect_to_repository_settings
(
@project
)
redirect_to_repository_settings
(
@project
)
end
end
...
...
spec/features/projects/deploy_keys_spec.rb
0 → 100644
View file @
e0d2f249
require
'spec_helper'
describe
'Project deploy keys'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project_empty_repo
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
end
describe
'removing key'
do
before
do
create
(
:deploy_keys_project
,
project:
project
)
end
it
'removes association between project and deploy key'
do
visit
namespace_project_settings_repository_path
(
project
.
namespace
,
project
)
page
.
within
'.deploy-keys'
do
expect
{
click_on
'Remove'
}
.
to
change
{
project
.
deploy_keys
.
count
}.
by
(
-
1
)
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