summaryrefslogtreecommitdiff
path: root/app/controllers/admin/application_settings_controller.rb
diff options
context:
space:
mode:
authorMartin Wortschack <mwortschack@gitlab.com>2018-09-11 08:43:10 +0200
committerMartin Wortschack <mwortschack@gitlab.com>2018-09-11 08:43:10 +0200
commita2f7936c74e6c9c4eed7b1c5641f0c43d4ff1375 (patch)
tree82b1ea27fe2a9a1be884467e10d9bde688ce97d1 /app/controllers/admin/application_settings_controller.rb
parentbfd2181310097f5c0a92a43ffc2b7b9540b96ad3 (diff)
parent2f990e3408d00cad473d8dcf8a4e49155cc3cc33 (diff)
downloadgitlab-ce-a2f7936c74e6c9c4eed7b1c5641f0c43d4ff1375.tar.gz
merge master and resolve conflicts
Diffstat (limited to 'app/controllers/admin/application_settings_controller.rb')
-rw-r--r--app/controllers/admin/application_settings_controller.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index e38241bd71a..eba30f6b186 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -9,13 +9,20 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
.new(@application_setting, current_user, application_setting_params)
.execute
+ if recheck_user_consent?
+ session[:ask_for_usage_stats_consent] = current_user.requires_usage_stats_consent?
+ end
+
redirect_path = request.referer.presence ? request.referer : admin_application_settings_path
- if successful
- redirect_to redirect_path,
- notice: 'Application settings saved successfully'
- else
- render :show
+ respond_to do |format|
+ if successful
+ format.json { head :ok }
+ format.html { redirect_to redirect_path, notice: 'Application settings saved successfully' }
+ else
+ format.json { head :bad_request }
+ format.html { render :show }
+ end
end
end
@@ -78,6 +85,13 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
)
end
+ def recheck_user_consent?
+ return false unless session[:ask_for_usage_stats_consent]
+ return false unless params[:application_setting]
+
+ params[:application_setting].key?(:usage_ping_enabled) || params[:application_setting].key?(:version_check_enabled)
+ end
+
def visible_application_setting_attributes
ApplicationSettingsHelper.visible_attributes + [
:domain_blacklist_file,