summaryrefslogtreecommitdiff
path: root/app/controllers/notification_settings_controller.rb
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-06-22 10:50:19 -0300
committerFelipe Artur <felipefac@gmail.com>2016-06-29 11:04:18 -0300
commit36d48120f66d52dcc8697893ca1ab85322ba7c8b (patch)
tree8c66cdb03c4429bf326711d8bd6956fbf45252b7 /app/controllers/notification_settings_controller.rb
parent2674b548601b279ada46d4b218a9def6fd5b9f6d (diff)
parent92e183542fe0e13930220ba3bbf67b9197cfc026 (diff)
downloadgitlab-ce-36d48120f66d52dcc8697893ca1ab85322ba7c8b.tar.gz
merge master into issue_3359_3
Diffstat (limited to 'app/controllers/notification_settings_controller.rb')
-rw-r--r--app/controllers/notification_settings_controller.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/app/controllers/notification_settings_controller.rb b/app/controllers/notification_settings_controller.rb
index aacbefd4ab8..8ec4bb1233f 100644
--- a/app/controllers/notification_settings_controller.rb
+++ b/app/controllers/notification_settings_controller.rb
@@ -2,8 +2,6 @@ class NotificationSettingsController < ApplicationController
before_action :authenticate_user!
def create
- resource = find_resource
-
return render_404 unless can_read?(resource)
@notification_setting = current_user.notification_settings_for(resource)
@@ -21,12 +19,12 @@ class NotificationSettingsController < ApplicationController
private
- def find_resource
- resource =
- if params[:project].present?
- Project.find(params[:project][:id])
- elsif params[:namespace].present?
- Group.find(params[:namespace][:id])
+ def resource
+ @resource ||=
+ if params[:project_id].present?
+ Project.find(params[:project_id])
+ elsif params[:namespace_id].present?
+ Group.find(params[:namespace_id])
end
end