Refactor
This commit is contained in:
		
							parent
							
								
									72872ee213
								
							
						
					
					
						commit
						ca5c762cf5
					
				|  | @ -94,11 +94,9 @@ class UsersController < ApplicationController | ||||||
|   private |   private | ||||||
| 
 | 
 | ||||||
|   def authorize_read_user! |   def authorize_read_user! | ||||||
|     if can?(current_user, :read_user, user) |     render_404 unless can?(current_user, :read_user, user) | ||||||
|       ensure_canonical_path(user.namespace, params[:username]) |      | ||||||
|     else |     ensure_canonical_path(user.namespace, params[:username]) | ||||||
|       render_404 |  | ||||||
|     end |  | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def user |   def user | ||||||
|  |  | ||||||
|  | @ -43,11 +43,13 @@ class Route < ActiveRecord::Base | ||||||
|     RedirectRoute.matching_path_and_descendants(path) |     RedirectRoute.matching_path_and_descendants(path) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def create_redirect_for_old_path |  | ||||||
|     create_redirect(path_was) if path_changed? |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   def create_redirect(path) |   def create_redirect(path) | ||||||
|     RedirectRoute.create(source: source, path: path) |     RedirectRoute.create(source: source, path: path) | ||||||
|   end |   end | ||||||
|  | 
 | ||||||
|  |   private | ||||||
|  | 
 | ||||||
|  |   def create_redirect_for_old_path | ||||||
|  |     create_redirect(path_was) if path_changed? | ||||||
|  |   end | ||||||
| end | end | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue