summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-05-03 10:33:01 -0700
committerMichael Kozono <mkozono@gmail.com>2017-05-05 12:11:58 -0700
commitca5c762cf577838a98c0ba96ce20b5f1d5dafc91 (patch)
tree4c9a8c50c18e075ce9b3d0dc1fc3843bbacdf366
parent72872ee2136436e48ce394268fc8bfb8a2118810 (diff)
downloadgitlab-ce-ca5c762cf577838a98c0ba96ce20b5f1d5dafc91.tar.gz
Refactor
-rw-r--r--app/controllers/users_controller.rb8
-rw-r--r--app/models/route.rb10
2 files changed, 9 insertions, 9 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 6b6b3b20a8d..d7c1241698a 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -94,11 +94,9 @@ class UsersController < ApplicationController
private
def authorize_read_user!
- if can?(current_user, :read_user, user)
- ensure_canonical_path(user.namespace, params[:username])
- else
- render_404
- end
+ render_404 unless can?(current_user, :read_user, user)
+
+ ensure_canonical_path(user.namespace, params[:username])
end
def user
diff --git a/app/models/route.rb b/app/models/route.rb
index e0d85ff7db7..accc423ae46 100644
--- a/app/models/route.rb
+++ b/app/models/route.rb
@@ -43,11 +43,13 @@ class Route < ActiveRecord::Base
RedirectRoute.matching_path_and_descendants(path)
end
- def create_redirect_for_old_path
- create_redirect(path_was) if path_changed?
- end
-
def create_redirect(path)
RedirectRoute.create(source: source, path: path)
end
+
+ private
+
+ def create_redirect_for_old_path
+ create_redirect(path_was) if path_changed?
+ end
end