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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
6fbf24af
Commit
6fbf24af
authored
Jan 25, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix /explore sorting (trending)
Fix
https://gitlab.com/gitlab-org/gitlab-ce/issues/27044
parent
1fe80c29
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
0 deletions
+41
-0
app/controllers/explore/projects_controller.rb
app/controllers/explore/projects_controller.rb
+1
-0
changelogs/unreleased/27044-fix-explore-sorting-on-trending.yml
...logs/unreleased/27044-fix-explore-sorting-on-trending.yml
+4
-0
spec/controllers/explore/projects_controller_spec.rb
spec/controllers/explore/projects_controller_spec.rb
+30
-0
spec/factories/trending_project.rb
spec/factories/trending_project.rb
+6
-0
No files found.
app/controllers/explore/projects_controller.rb
View file @
6fbf24af
...
@@ -22,6 +22,7 @@ class Explore::ProjectsController < Explore::ApplicationController
...
@@ -22,6 +22,7 @@ class Explore::ProjectsController < Explore::ApplicationController
def
trending
def
trending
@projects
=
filter_projects
(
Project
.
trending
)
@projects
=
filter_projects
(
Project
.
trending
)
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
page
(
params
[
:page
])
@projects
=
@projects
.
page
(
params
[
:page
])
respond_to
do
|
format
|
respond_to
do
|
format
|
...
...
changelogs/unreleased/27044-fix-explore-sorting-on-trending.yml
0 → 100644
View file @
6fbf24af
---
title
:
Fix /explore sorting
merge_request
:
author
:
spec/controllers/explore/projects_controller_spec.rb
0 → 100644
View file @
6fbf24af
require
'spec_helper'
describe
Explore
::
ProjectsController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:visibility
)
{
:public
}
describe
'GET #trending'
do
let!
(
:project_1
)
{
create
(
:project
,
visibility
,
ci_id:
1
)
}
let!
(
:project_2
)
{
create
(
:project
,
visibility
,
ci_id:
2
)
}
let!
(
:trending_project_1
)
{
create
(
:trending_project
,
project:
project_1
)
}
let!
(
:trending_project_2
)
{
create
(
:trending_project
,
project:
project_2
)
}
before
do
sign_in
(
user
)
end
context
'sorting by update date'
do
it
'sorts by last updated'
do
get
:trending
,
sort:
'updated_desc'
expect
(
assigns
(
:projects
)).
to
eq
[
project_2
,
project_1
]
end
it
'sorts by oldest updated'
do
get
:trending
,
sort:
'updated_asc'
expect
(
assigns
(
:projects
)).
to
eq
[
project_1
,
project_2
]
end
end
end
end
spec/factories/trending_project.rb
0 → 100644
View file @
6fbf24af
FactoryGirl
.
define
do
# TrendingProject
factory
:trending_project
,
class:
'TrendingProject'
do
project
end
end
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