summaryrefslogtreecommitdiff
path: root/app/controllers/notification_settings_controller.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 12:06:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 12:06:26 +0000
commit0be510a49f6e4f8e27b19b707fd1dac61571f78f (patch)
tree97ca0053d4fad66e900d25fdba61b2adb611efb0 /app/controllers/notification_settings_controller.rb
parent6026bddcd51eca573c530240c421392045172b89 (diff)
downloadgitlab-ce-0be510a49f6e4f8e27b19b707fd1dac61571f78f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/notification_settings_controller.rb')
-rw-r--r--app/controllers/notification_settings_controller.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/app/controllers/notification_settings_controller.rb b/app/controllers/notification_settings_controller.rb
index c97fec0a6ee..e5d4a4bb073 100644
--- a/app/controllers/notification_settings_controller.rb
+++ b/app/controllers/notification_settings_controller.rb
@@ -16,12 +16,7 @@ class NotificationSettingsController < ApplicationController
@notification_setting = current_user.notification_settings.find(params[:id])
@saved = @notification_setting.update(notification_setting_params_for(@notification_setting.source))
- if params[:hide_label].present?
- btn_class = params[:project_id].present? ? 'btn-xs' : ''
- render_response("shared/notifications/_new_button", btn_class)
- else
- render_response
- end
+ render_response
end
private
@@ -42,7 +37,16 @@ class NotificationSettingsController < ApplicationController
can?(current_user, ability_name, resource)
end
- def render_response(response_template = "shared/notifications/_button", btn_class = nil)
+ def render_response
+ btn_class = nil
+
+ if params[:hide_label].present?
+ btn_class = 'btn-xs' if params[:project_id].present?
+ response_template = 'shared/notifications/_new_button'
+ else
+ response_template = 'shared/notifications/_button'
+ end
+
render json: {
html: view_to_html_string(response_template, notification_setting: @notification_setting, btn_class: btn_class),
saved: @saved