summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-04-11 19:33:26 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-04-12 12:10:58 -0300
commitef22b76b732c2bf4ce52b8a73570ac2921f9caa4 (patch)
tree871bb03716893281710875869f726d1aca05ed63
parentfe58c1f13cc0758bbbd8f85b8794b458b3a72b55 (diff)
downloadgitlab-ce-ef22b76b732c2bf4ce52b8a73570ac2921f9caa4.tar.gz
Simplify Projects::NotificationSettingsController
-rw-r--r--app/controllers/projects/notification_settings_controller.rb7
-rw-r--r--app/views/projects/buttons/_notifications.html.haml2
-rw-r--r--config/routes.rb2
3 files changed, 2 insertions, 9 deletions
diff --git a/app/controllers/projects/notification_settings_controller.rb b/app/controllers/projects/notification_settings_controller.rb
index e536725c5b1..7d81cc03c73 100644
--- a/app/controllers/projects/notification_settings_controller.rb
+++ b/app/controllers/projects/notification_settings_controller.rb
@@ -1,13 +1,6 @@
class Projects::NotificationSettingsController < Projects::ApplicationController
before_action :authenticate_user!
- def create
- notification_setting = current_user.notification_settings_for(project)
- saved = notification_setting.update_attributes(notification_setting_params)
-
- render json: { saved: saved }
- end
-
def update
notification_setting = current_user.notification_settings_for(project)
saved = notification_setting.update_attributes(notification_setting_params)
diff --git a/app/views/projects/buttons/_notifications.html.haml b/app/views/projects/buttons/_notifications.html.haml
index 49f541399f2..c1e3e5b73a2 100644
--- a/app/views/projects/buttons/_notifications.html.haml
+++ b/app/views/projects/buttons/_notifications.html.haml
@@ -1,5 +1,5 @@
- if @notification_setting
- = form_for @notification_setting, url: namespace_project_notification_setting_path(@project.namespace.becomes(Namespace), @project), remote: true, html: { class: 'inline', id: 'notification-form' } do |f|
+ = form_for @notification_setting, url: namespace_project_notification_setting_path(@project.namespace.becomes(Namespace), @project), method: :patch, remote: true, html: { class: 'inline', id: 'notification-form' } do |f|
= f.hidden_field :level
%span.dropdown
%a.dropdown-new.btn.notifications-btn#notifications-button{href: '#', "data-toggle" => "dropdown"}
diff --git a/config/routes.rb b/config/routes.rb
index 552385110dd..48601b7567b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -608,7 +608,7 @@ Rails.application.routes.draw do
resources :forks, only: [:index, :new, :create]
resource :import, only: [:new, :create, :show]
- resource :notification_setting, only: [:create, :update]
+ resource :notification_setting, only: [:update]
resources :refs, only: [] do
collection do