Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c17127d4
Commit
c17127d4
authored
Jul 02, 2020
by
Laura Montemayor
Committed by
lauraMon
Jul 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates with feedback
parent
fa5f9b1c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+6
-3
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+11
-3
No files found.
app/controllers/projects/pipelines_controller.rb
View file @
c17127d4
...
...
@@ -19,7 +19,8 @@ class Projects::PipelinesController < Projects::ApplicationController
end
before_action
:ensure_pipeline
,
only:
[
:show
]
before_action
:ensure_valid_scope
,
only:
[
:index
]
# Will be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/225596
before_action
:redirect_for_legacy_scope_filter
,
only:
[
:index
],
if:
->
{
request
.
format
.
html?
}
around_action
:allow_gitaly_ref_name_caching
,
only:
[
:index
,
:show
]
...
...
@@ -225,8 +226,10 @@ class Projects::PipelinesController < Projects::ApplicationController
render_404
unless
pipeline
end
def
ensure_valid_scope
redirect_to
project_pipelines_path
(
project
,
status:
params
[
:scope
])
if
%w[running pending]
.
include?
(
params
[
:scope
])
def
redirect_for_legacy_scope_filter
return
unless
%w[running pending]
.
include?
(
params
[
:scope
])
redirect_to
url_for
(
safe_params
.
except
(
:scope
).
merge
(
status:
safe_params
[
:scope
])),
status: :moved_permanently
end
# rubocop: disable CodeReuse/ActiveRecord
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
c17127d4
...
...
@@ -119,11 +119,11 @@ RSpec.describe Projects::PipelinesController do
end
end
context
'when
scope is pending or running
'
do
context
'when
user tries to access legacy scope via URL
'
do
it
'redirects to all pipelines with that status instead'
do
get_pipelines_index_
json
(
scope:
'running'
)
get_pipelines_index_
html
(
scope:
'running'
)
expect
(
response
).
to
redirect_to
(
project_pipelines_path
(
project
,
status:
'running'
))
expect
(
response
).
to
redirect_to
(
project_pipelines_path
(
project
,
status:
'running'
,
format: :html
))
end
end
...
...
@@ -219,6 +219,14 @@ RSpec.describe Projects::PipelinesController do
end
end
def
get_pipelines_index_html
(
params
=
{})
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}.
merge
(
params
),
format: :html
end
def
get_pipelines_index_json
(
params
=
{})
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment