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
99e97ba5
Commit
99e97ba5
authored
Jan 14, 2021
by
Aakriti Gupta
Committed by
Michael Kozono
Jan 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove maintenance mode message when it mode is disabled
parent
cd36ef64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
ee/app/services/ee/application_settings/update_service.rb
ee/app/services/ee/application_settings/update_service.rb
+4
-0
ee/spec/controllers/admin/application_settings_controller_spec.rb
...controllers/admin/application_settings_controller_spec.rb
+59
-0
No files found.
ee/app/services/ee/application_settings/update_service.rb
View file @
99e97ba5
...
...
@@ -12,6 +12,10 @@ module EE
limit
=
params
.
delete
(
:repository_size_limit
)
application_setting
.
repository_size_limit
=
::
Gitlab
::
Utils
.
try_megabytes_to_bytes
(
limit
)
if
limit
if
params
[
:maintenance_mode
]
==
false
||
params
[
:maintenance_mode_message
]
==
''
params
[
:maintenance_mode_message
]
=
nil
end
elasticsearch_namespace_ids
=
params
.
delete
(
:elasticsearch_namespace_ids
)
elasticsearch_project_ids
=
params
.
delete
(
:elasticsearch_project_ids
)
...
...
ee/spec/controllers/admin/application_settings_controller_spec.rb
View file @
99e97ba5
...
...
@@ -269,6 +269,58 @@ RSpec.describe Admin::ApplicationSettingsController do
expect
(
response
).
to
redirect_to
(
general_admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
enforce_pat_expiration
).
to
be_falsey
end
context
'maintenance mode settings'
do
let
(
:message
)
{
'Maintenance mode is on.'
}
before
do
stub_licensed_features
(
geo:
true
)
end
it
"updates maintenance_mode setting"
do
put
:update
,
params:
{
application_setting:
{
maintenance_mode:
true
}
}
expect
(
response
).
to
redirect_to
(
general_admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
maintenance_mode
).
to
be_truthy
end
it
"updates maintenance_mode_message setting"
do
put
:update
,
params:
{
application_setting:
{
maintenance_mode_message:
message
}
}
expect
(
response
).
to
redirect_to
(
general_admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
maintenance_mode_message
).
to
eq
(
message
)
end
context
'when update disables maintenance mode'
do
it
'removes maintenance_mode_message setting'
do
put
:update
,
params:
{
application_setting:
{
maintenance_mode:
false
}
}
expect
(
response
).
to
redirect_to
(
general_admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
maintenance_mode
).
to
be_falsy
expect
(
ApplicationSetting
.
current
.
maintenance_mode_message
).
to
be_nil
end
end
context
'when update does not disable maintenance mode'
do
it
'does not remove maintenance_mode_message'
do
set_maintenance_mode
(
message
)
put
:update
,
params:
{
application_setting:
{}
}
expect
(
ApplicationSetting
.
current
.
maintenance_mode_message
).
to
eq
(
message
)
end
end
context
'when updating maintenance_mode_message with empty string'
do
it
'removes maintenance_mode_message'
do
set_maintenance_mode
(
message
)
put
:update
,
params:
{
application_setting:
{
maintenance_mode_message:
''
}
}
expect
(
ApplicationSetting
.
current
.
maintenance_mode_message
).
to
eq
(
nil
)
end
end
end
end
describe
'GET #seat_link_payload'
do
...
...
@@ -324,4 +376,11 @@ RSpec.describe Admin::ApplicationSettingsController do
end
end
end
def
set_maintenance_mode
(
message
)
ApplicationSetting
.
current
.
update!
(
maintenance_mode:
true
,
maintenance_mode_message:
message
)
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