Commit e1c245af authored by Michael Kozono's avatar Michael Kozono

Resolve discussions

parent f05469f9
...@@ -21,13 +21,12 @@ class Projects::ApplicationController < ApplicationController ...@@ -21,13 +21,12 @@ class Projects::ApplicationController < ApplicationController
end end
def project def project
@project ||= find_routable!(Project, return @project if @project
File.join(params[:namespace_id], params[:project_id] || params[:id]),
extra_authorization_proc: project_not_being_deleted?) path = File.join(params[:namespace_id], params[:project_id] || params[:id])
end auth_proc = ->(project) { !project.pending_delete? }
def project_not_being_deleted? @project = find_routable!(Project, path, extra_authorization_proc: auth_proc)
->(project) { !project.pending_delete? }
end end
def repository def repository
......
...@@ -16,7 +16,7 @@ class Route < ActiveRecord::Base ...@@ -16,7 +16,7 @@ class Route < ActiveRecord::Base
scope :direct_descendant_routes, -> (path) { where('routes.path LIKE ? AND routes.path NOT LIKE ?', "#{sanitize_sql_like(path)}/%", "#{sanitize_sql_like(path)}/%/%") } scope :direct_descendant_routes, -> (path) { where('routes.path LIKE ? AND routes.path NOT LIKE ?', "#{sanitize_sql_like(path)}/%", "#{sanitize_sql_like(path)}/%/%") }
def rename_direct_descendant_routes def rename_direct_descendant_routes
return if !path_changed? && !name_changed? return unless path_changed? || name_changed?
direct_descendant_routes = self.class.direct_descendant_routes(path_was) direct_descendant_routes = self.class.direct_descendant_routes(path_was)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment