From f86a507745695f3b073d6edb6029836ab115765a Mon Sep 17 00:00:00 2001
From: Lin Jen-Shin <godfat@godfat.org>
Date: Tue, 16 Aug 2016 22:10:10 +0800
Subject: [PATCH] Rename to latest_succeeded, feedback:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5142#note_13908017
---
 app/controllers/projects/artifacts_controller.rb | 2 +-
 app/views/projects/branches/_branch.html.haml    | 2 +-
 app/views/projects/buttons/_download.html.haml   | 2 +-
 app/views/projects/tags/_download.html.haml      | 2 +-
 config/routes.rb                                 | 7 ++++---
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb
index b7c395a01a3..5cc6d643b64 100644
--- a/app/controllers/projects/artifacts_controller.rb
+++ b/app/controllers/projects/artifacts_controller.rb
@@ -34,7 +34,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
     redirect_to namespace_project_build_path(project.namespace, project, build)
   end
 
-  def search
+  def latest_succeeded
     path = params[:path]
 
     if %w[download browse file].include?(path)
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index 12b78be4be0..5634abf3641 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -46,7 +46,7 @@
                 %li.dropdown-header Previous Artifacts
               - artifacts.each do |job|
                 %li
-                  = link_to search_namespace_project_artifacts_path(@project.namespace, @project, branch.name, 'download', job: job.name), rel: 'nofollow' do
+                  = link_to latest_succeeded_namespace_project_artifacts_path(@project.namespace, @project, branch.name, 'download', job: job.name), rel: 'nofollow' do
                     %span Download '#{job.name}'
 
       - if can_remove_branch?(@project, branch.name)
diff --git a/app/views/projects/buttons/_download.html.haml b/app/views/projects/buttons/_download.html.haml
index 45998343fda..177946dcd42 100644
--- a/app/views/projects/buttons/_download.html.haml
+++ b/app/views/projects/buttons/_download.html.haml
@@ -26,5 +26,5 @@
               %li.dropdown-header Previous Artifacts
             - artifacts.each do |job|
               %li
-                = link_to search_namespace_project_artifacts_path(@project.namespace, @project, @ref, 'download', job: job.name), rel: 'nofollow' do
+                = link_to latest_succeeded_namespace_project_artifacts_path(@project.namespace, @project, @ref, 'download', job: job.name), rel: 'nofollow' do
                   %span Download '#{job.name}'
diff --git a/app/views/projects/tags/_download.html.haml b/app/views/projects/tags/_download.html.haml
index 60f1e2cd2ee..316d03dd12a 100644
--- a/app/views/projects/tags/_download.html.haml
+++ b/app/views/projects/tags/_download.html.haml
@@ -24,5 +24,5 @@
           %li.dropdown-header Previous Artifacts
         - artifacts.each do |job|
           %li
-            = link_to search_namespace_project_artifacts_path(project.namespace, project, ref, 'download', job: job.name), rel: 'nofollow' do
+            = link_to latest_succeeded_namespace_project_artifacts_path(project.namespace, project, ref, 'download', job: job.name), rel: 'nofollow' do
               %span Download '#{job.name}'
diff --git a/config/routes.rb b/config/routes.rb
index 70bdb1d5beb..da10c5609f6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -765,9 +765,10 @@ Rails.application.routes.draw do
 
             resources :artifacts, only: [] do
               collection do
-                get :search, path: ':ref_name/*path',
-                             format: false,
-                             constraints: { ref_name: /.+/ } # could have /
+                get :latest_succeeded,
+                  path: ':ref_name/*path',
+                  format: false,
+                  constraints: { ref_name: /.+/ } # could have /
               end
             end
           end
-- 
2.30.9