BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d02e7226
Commit
d02e7226
authored
May 01, 2017
by
Mark Fletcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect already enabled DeployKeys in EnableDeployKeyService
Ensures deploy keys can't be re-added, which causes a validation error
parent
03f13af5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
enable_deploy_key_service.rb
app/services/projects/enable_deploy_key_service.rb
+4
-1
29673-500-internal-server-error-when-enabling-a-deploy-key-more-than-once-through-api.yml
...when-enabling-a-deploy-key-more-than-once-through-api.yml
+4
-0
enable_deploy_key_service_spec.rb
spec/services/projects/enable_deploy_key_service_spec.rb
+10
-0
No files found.
app/services/projects/enable_deploy_key_service.rb
View file @
d02e7226
...
...
@@ -4,7 +4,10 @@ module Projects
key
=
accessible_keys
.
find_by
(
id:
params
[
:key_id
]
||
params
[
:id
])
return
unless
key
project
.
deploy_keys
<<
key
unless
project
.
deploy_keys
.
include?
(
key
)
project
.
deploy_keys
<<
key
end
key
end
...
...
changelogs/unreleased/29673-500-internal-server-error-when-enabling-a-deploy-key-more-than-once-through-api.yml
0 → 100644
View file @
d02e7226
---
title
:
Detect already enabled DeployKeys in EnableDeployKeyService
merge_request
:
author
:
spec/services/projects/enable_deploy_key_service_spec.rb
View file @
d02e7226
...
...
@@ -21,6 +21,16 @@ describe Projects::EnableDeployKeyService, services: true do
end
end
context
'add the same key twice'
do
before
do
project
.
deploy_keys
<<
deploy_key
end
it
'returns existing key'
do
expect
(
service
.
execute
).
to
eq
(
deploy_key
)
end
end
def
service
Projects
::
EnableDeployKeyService
.
new
(
project
,
user
,
params
)
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