Merge branch 'backport-ee-1067-deal-with-repo-size-limit-as-byte' into 'master'
EE backport for new application settings update service See merge request !8665
This commit is contained in:
commit
1fe80c2962
4 changed files with 34 additions and 12 deletions
|
@ -5,7 +5,11 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
if @application_setting.update_attributes(application_setting_params)
|
||||
successful = ApplicationSettings::UpdateService
|
||||
.new(@application_setting, current_user, application_setting_params)
|
||||
.execute
|
||||
|
||||
if successful
|
||||
redirect_to admin_application_settings_path,
|
||||
notice: 'Application settings saved successfully'
|
||||
else
|
||||
|
|
7
app/services/application_settings/base_service.rb
Normal file
7
app/services/application_settings/base_service.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
module ApplicationSettings
|
||||
class BaseService < ::BaseService
|
||||
def initialize(application_setting, user, params = {})
|
||||
@application_setting, @current_user, @params = application_setting, user, params.dup
|
||||
end
|
||||
end
|
||||
end
|
7
app/services/application_settings/update_service.rb
Normal file
7
app/services/application_settings/update_service.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
module ApplicationSettings
|
||||
class UpdateService < ApplicationSettings::BaseService
|
||||
def execute
|
||||
@application_setting.update(@params)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -22,17 +22,7 @@ module Projects
|
|||
return @project
|
||||
end
|
||||
|
||||
# Set project name from path
|
||||
if @project.name.present? && @project.path.present?
|
||||
# if both name and path set - everything is ok
|
||||
elsif @project.path.present?
|
||||
# Set project name from path
|
||||
@project.name = @project.path.dup
|
||||
elsif @project.name.present?
|
||||
# For compatibility - set path from name
|
||||
# TODO: remove this in 8.0
|
||||
@project.path = @project.name.dup.parameterize
|
||||
end
|
||||
set_project_name_from_path
|
||||
|
||||
# get namespace id
|
||||
namespace_id = params[:namespace_id]
|
||||
|
@ -144,5 +134,19 @@ module Projects
|
|||
service.save!
|
||||
end
|
||||
end
|
||||
|
||||
def set_project_name_from_path
|
||||
# Set project name from path
|
||||
if @project.name.present? && @project.path.present?
|
||||
# if both name and path set - everything is ok
|
||||
elsif @project.path.present?
|
||||
# Set project name from path
|
||||
@project.name = @project.path.dup
|
||||
elsif @project.name.present?
|
||||
# For compatibility - set path from name
|
||||
# TODO: remove this in 8.0
|
||||
@project.path = @project.name.dup.parameterize
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue