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
path: root/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-05-06 08:45:56 +0300
committerSean McGivern <sean@mcgivern.me.uk>2017-05-06 08:45:56 +0300
commit56fb7823f9740d4595d90dcb224180c950a27048 (patch)
treeebf2f5498f164477cfe594ea6b820202087532a9 /lib
parent6ce1df41e175c7d62ca760b1e66cf1bf86150284 (diff)
parentb0ee22609a89572d6e3f98eebccf9fb2335dd939 (diff)
Merge branch '17361-redirect-renamed-paths' into 'master'
Resolve "Redirect to new project link after a rename" Closes #17361 and #30317 See merge request !11136
Diffstat (limited to 'lib')
-rw-r--r--lib/constraints/group_url_constrainer.rb2
-rw-r--r--lib/constraints/project_url_constrainer.rb2
-rw-r--r--lib/constraints/user_url_constrainer.rb2
-rw-r--r--lib/tasks/migrate/setup_postgresql.rake1
4 files changed, 4 insertions, 3 deletions
diff --git a/lib/constraints/group_url_constrainer.rb b/lib/constraints/group_url_constrainer.rb
index 1501f64d537..5f379756c11 100644
--- a/lib/constraints/group_url_constrainer.rb
+++ b/lib/constraints/group_url_constrainer.rb
@@ -4,6 +4,6 @@ class GroupUrlConstrainer
return false unless DynamicPathValidator.valid?(id)
- Group.find_by_full_path(id).present?
+ Group.find_by_full_path(id, follow_redirects: request.get?).present?
end
end
diff --git a/lib/constraints/project_url_constrainer.rb b/lib/constraints/project_url_constrainer.rb
index d0ce2caffff..6f542f63f98 100644
--- a/lib/constraints/project_url_constrainer.rb
+++ b/lib/constraints/project_url_constrainer.rb
@@ -6,6 +6,6 @@ class ProjectUrlConstrainer
return false unless DynamicPathValidator.valid?(full_path)
- Project.find_by_full_path(full_path).present?
+ Project.find_by_full_path(full_path, follow_redirects: request.get?).present?
end
end
diff --git a/lib/constraints/user_url_constrainer.rb b/lib/constraints/user_url_constrainer.rb
index 9ab5bcb12ff..28159dc0dec 100644
--- a/lib/constraints/user_url_constrainer.rb
+++ b/lib/constraints/user_url_constrainer.rb
@@ -1,5 +1,5 @@
class UserUrlConstrainer
def matches?(request)
- User.find_by_username(request.params[:username]).present?
+ User.find_by_full_path(request.params[:username], follow_redirects: request.get?).present?
end
end
diff --git a/lib/tasks/migrate/setup_postgresql.rake b/lib/tasks/migrate/setup_postgresql.rake
index 8938bc515f5..1e00b47303d 100644
--- a/lib/tasks/migrate/setup_postgresql.rake
+++ b/lib/tasks/migrate/setup_postgresql.rake
@@ -11,4 +11,5 @@ task setup_postgresql: :environment do
AddUsersLowerUsernameEmailIndexes.new.up
AddLowerPathIndexToRoutes.new.up
IndexRoutesPathForLike.new.up
+ IndexRedirectRoutesPathForLike.new.up
end