BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d7a2e92c
Commit
d7a2e92c
authored
Dec 21, 2016
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
applies url_for so that we dont lose filters when redirecting
parent
805bbe88
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
11 deletions
+13
-11
todos_controller.rb
app/controllers/dashboard/todos_controller.rb
+1
-1
issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
todos_controller_spec.rb
spec/controllers/dashboard/todos_controller_spec.rb
+2
-1
issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+3
-2
merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+4
-4
snippets_controller_spec.rb
spec/controllers/projects/snippets_controller_spec.rb
+1
-1
No files found.
app/controllers/dashboard/todos_controller.rb
View file @
d7a2e92c
...
@@ -5,7 +5,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
...
@@ -5,7 +5,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
@sort
=
params
[
:sort
]
@sort
=
params
[
:sort
]
@todos
=
@todos
.
page
(
params
[
:page
])
@todos
=
@todos
.
page
(
params
[
:page
])
if
@todos
.
out_of_range?
&&
@todos
.
total_pages
!=
0
if
@todos
.
out_of_range?
&&
@todos
.
total_pages
!=
0
redirect_to
dashboard_todos_path
(
page:
@todos
.
total_pages
)
redirect_to
url_for
(
params
.
merge
(
page:
@todos
.
total_pages
)
)
end
end
end
end
...
...
app/controllers/projects/issues_controller.rb
View file @
d7a2e92c
...
@@ -26,7 +26,7 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -26,7 +26,7 @@ class Projects::IssuesController < Projects::ApplicationController
@issues
=
issues_collection
@issues
=
issues_collection
@issues
=
@issues
.
page
(
params
[
:page
])
@issues
=
@issues
.
page
(
params
[
:page
])
if
@issues
.
out_of_range?
&&
@issues
.
total_pages
!=
0
if
@issues
.
out_of_range?
&&
@issues
.
total_pages
!=
0
return
redirect_to
namespace_project_issues_path
(
page:
@issues
.
total_pages
)
return
redirect_to
url_for
(
params
.
merge
(
page:
@issues
.
total_pages
)
)
end
end
if
params
[
:label_name
].
present?
if
params
[
:label_name
].
present?
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
d7a2e92c
...
@@ -39,7 +39,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -39,7 +39,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_requests
=
merge_requests_collection
@merge_requests
=
merge_requests_collection
@merge_requests
=
@merge_requests
.
page
(
params
[
:page
])
@merge_requests
=
@merge_requests
.
page
(
params
[
:page
])
if
@merge_requests
.
out_of_range?
&&
@merge_requests
.
total_pages
!=
0
if
@merge_requests
.
out_of_range?
&&
@merge_requests
.
total_pages
!=
0
return
redirect_to
namespace_project_merge_requests_path
(
page:
@merge_requests
.
total_pages
)
return
redirect_to
url_for
(
params
.
merge
(
page:
@merge_requests
.
total_pages
)
)
end
end
if
params
[
:label_name
].
present?
if
params
[
:label_name
].
present?
...
...
spec/controllers/dashboard/todos_controller_spec.rb
View file @
d7a2e92c
...
@@ -13,10 +13,11 @@ describe Dashboard::TodosController do
...
@@ -13,10 +13,11 @@ describe Dashboard::TodosController do
context
'when using pagination'
do
context
'when using pagination'
do
let
(
:last_page
)
{
user
.
todos
.
page
().
total_pages
}
let
(
:last_page
)
{
user
.
todos
.
page
().
total_pages
}
let!
(
:issues
)
{
create_list
(
:issue
,
30
,
project:
project
,
assignee:
user
)
}
let!
(
:issues
)
{
create_list
(
:issue
,
2
,
project:
project
,
assignee:
user
)
}
before
do
before
do
issues
.
each
{
|
issue
|
todo_service
.
new_issue
(
issue
,
user
)
}
issues
.
each
{
|
issue
|
todo_service
.
new_issue
(
issue
,
user
)
}
allow
(
Kaminari
.
config
).
to
receive
(
:default_per_page
).
and_return
(
1
)
end
end
it
'redirects to last_page if page number is larger than number of pages'
do
it
'redirects to last_page if page number is larger than number of pages'
do
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
d7a2e92c
...
@@ -55,11 +55,12 @@ describe Projects::IssuesController do
...
@@ -55,11 +55,12 @@ describe Projects::IssuesController do
context
'with page param'
do
context
'with page param'
do
let
(
:last_page
)
{
project
.
issues
.
page
().
total_pages
}
let
(
:last_page
)
{
project
.
issues
.
page
().
total_pages
}
let!
(
:issue_list
)
{
create_list
(
:issue
,
30
,
project:
project
)
}
let!
(
:issue_list
)
{
create_list
(
:issue
,
2
,
project:
project
)
}
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
project
.
team
<<
[
user
,
:developer
]
allow
(
Kaminari
.
config
).
to
receive
(
:default_per_page
).
and_return
(
1
)
end
end
it
'redirects to last_page if page number is larger than number of pages'
do
it
'redirects to last_page if page number is larger than number of pages'
do
...
@@ -68,7 +69,7 @@ describe Projects::IssuesController do
...
@@ -68,7 +69,7 @@ describe Projects::IssuesController do
project_id:
project
.
path
.
to_param
,
project_id:
project
.
path
.
to_param
,
page:
(
last_page
+
1
).
to_param
page:
(
last_page
+
1
).
to_param
expect
(
response
).
to
redirect_to
(
namespace_project_issues_path
(
page:
last_page
))
expect
(
response
).
to
redirect_to
(
namespace_project_issues_path
(
page:
last_page
,
state:
controller
.
params
[
:state
],
scope:
controller
.
params
[
:scope
]
))
end
end
it
'redirects to specified page'
do
it
'redirects to specified page'
do
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
d7a2e92c
...
@@ -127,9 +127,6 @@ describe Projects::MergeRequestsController do
...
@@ -127,9 +127,6 @@ describe Projects::MergeRequestsController do
end
end
describe
'GET index'
do
describe
'GET index'
do
let
(
:last_page
)
{
project
.
merge_requests
.
page
().
total_pages
}
let!
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
target_project:
project
,
source_project:
project
)
}
def
get_merge_requests
(
page
=
nil
)
def
get_merge_requests
(
page
=
nil
)
get
:index
,
get
:index
,
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
...
@@ -138,10 +135,13 @@ describe Projects::MergeRequestsController do
...
@@ -138,10 +135,13 @@ describe Projects::MergeRequestsController do
end
end
context
'when page param'
do
context
'when page param'
do
let
(
:last_page
)
{
project
.
merge_requests
.
page
().
total_pages
}
let!
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
target_project:
project
,
source_project:
project
)
}
it
'redirects to last_page if page number is larger than number of pages'
do
it
'redirects to last_page if page number is larger than number of pages'
do
get_merge_requests
(
last_page
+
1
)
get_merge_requests
(
last_page
+
1
)
expect
(
response
).
to
redirect_to
(
namespace_project_merge_requests_path
(
page:
last_page
))
expect
(
response
).
to
redirect_to
(
namespace_project_merge_requests_path
(
page:
last_page
,
state:
controller
.
params
[
:state
],
scope:
controller
.
params
[
:scope
]
))
end
end
it
'redirects to specified page'
do
it
'redirects to specified page'
do
...
...
spec/controllers/projects/snippets_controller_spec.rb
View file @
d7a2e92c
...
@@ -26,7 +26,7 @@ describe Projects::SnippetsController do
...
@@ -26,7 +26,7 @@ describe Projects::SnippetsController do
it
'redirects to specified page'
do
it
'redirects to specified page'
do
get
:index
,
get
:index
,
namespace_id:
project
.
namespace
.
path
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
page:
(
last_page
)
.
to_param
project_id:
project
.
path
,
page:
last_page
.
to_param
expect
(
assigns
(
:snippets
).
current_page
).
to
eq
(
last_page
)
expect
(
assigns
(
:snippets
).
current_page
).
to
eq
(
last_page
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
...
...
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