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
3435195f
Commit
3435195f
authored
Feb 24, 2020
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent deletion a serverless domain that is in use
parent
004dbe1c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
app/controllers/admin/serverless/domains_controller.rb
app/controllers/admin/serverless/domains_controller.rb
+6
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/controllers/admin/serverless/domains_controller_spec.rb
spec/controllers/admin/serverless/domains_controller_spec.rb
+14
-0
No files found.
app/controllers/admin/serverless/domains_controller.rb
View file @
3435195f
...
...
@@ -31,6 +31,12 @@ class Admin::Serverless::DomainsController < Admin::ApplicationController
end
def
destroy
if
domain
.
serverless_domain_clusters
.
count
>
0
return
redirect_to
admin_serverless_domains_path
,
status: :conflict
,
notice:
_
(
'Domain cannot be deleted while associated to one or more clusters.'
)
end
domain
.
destroy!
redirect_to
admin_serverless_domains_path
,
...
...
locale/gitlab.pot
View file @
3435195f
...
...
@@ -6880,6 +6880,9 @@ msgstr ""
msgid "Domain"
msgstr ""
msgid "Domain cannot be deleted while associated to one or more clusters."
msgstr ""
msgid "Domain verification is an essential security measure for public GitLab sites. Users are required to demonstrate they control a domain before it is enabled"
msgstr ""
...
...
spec/controllers/admin/serverless/domains_controller_spec.rb
View file @
3435195f
...
...
@@ -338,6 +338,20 @@ describe Admin::Serverless::DomainsController do
expect
(
flash
[
:notice
]).
to
include
(
'Domain was successfully deleted.'
)
end
end
context
'and is associated to any clusters'
do
before
do
create
(
:serverless_domain_cluster
,
pages_domain:
domain
)
end
it
'does not delete the domain'
do
expect
{
delete
:destroy
,
params:
{
id:
domain
.
id
}
}
.
not_to
change
{
PagesDomain
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
:conflict
)
expect
(
flash
[
:notice
]).
to
include
(
'Domain cannot be deleted while associated to one or more clusters.'
)
end
end
end
context
'when domain does not exist'
do
...
...
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