Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-05-04 01:26:44 +0300
committerMichael Kozono <mkozono@gmail.com>2017-05-05 22:12:49 +0300
commit0c866f4a575d8127efbf3eafda83d8ccfbd97817 (patch)
treeda00182ea8dbba39cf72ae15b857b40aa84d5342 /app/models
parentfc061c2ecd2e292383017c703220bfb22d0d6dce (diff)
Resolve discussions
Diffstat (limited to 'app/models')
-rw-r--r--app/models/route.rb22
-rw-r--r--app/models/user.rb2
2 files changed, 12 insertions, 12 deletions
diff --git a/app/models/route.rb b/app/models/route.rb
index accc423ae46..3d798ce937b 100644
--- a/app/models/route.rb
+++ b/app/models/route.rb
@@ -16,22 +16,22 @@ 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)}/%/%") }
def rename_direct_descendant_routes
- if path_changed? || name_changed?
- direct_descendant_routes = self.class.direct_descendant_routes(path_was)
+ return if !path_changed? && !name_changed?
- direct_descendant_routes.each do |route|
- attributes = {}
+ direct_descendant_routes = self.class.direct_descendant_routes(path_was)
- if path_changed? && route.path.present?
- attributes[:path] = route.path.sub(path_was, path)
- end
+ direct_descendant_routes.each do |route|
+ attributes = {}
- if name_changed? && name_was.present? && route.name.present?
- attributes[:name] = route.name.sub(name_was, name)
- end
+ if path_changed? && route.path.present?
+ attributes[:path] = route.path.sub(path_was, path)
+ end
- route.update(attributes) unless attributes.empty?
+ if name_changed? && name_was.present? && route.name.present?
+ attributes[:name] = route.name.sub(name_was, name)
end
+
+ route.update(attributes) unless attributes.empty?
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index c6354b989ad..7da92d03427 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -335,7 +335,7 @@ class User < ActiveRecord::Base
def find_by_full_path(path, follow_redirects: false)
namespace = Namespace.find_by_full_path(path, follow_redirects: follow_redirects)
- namespace.owner if namespace && namespace.owner
+ namespace&.owner
end
def reference_prefix