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
Boxiang Sun
gitlab-ce
Commits
d8a9bfb6
Commit
d8a9bfb6
authored
Apr 05, 2018
by
Takuya Noguchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Order UsersController#projects.json by updated_at
parent
2e350216
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
10 deletions
+17
-10
app/finders/personal_projects_finder.rb
app/finders/personal_projects_finder.rb
+1
-1
changelogs/unreleased/45065-users-projects-json-sort.yml
changelogs/unreleased/45065-users-projects-json-sort.yml
+5
-0
spec/features/users/user_browses_projects_on_user_page_spec.rb
...features/users/user_browses_projects_on_user_page_spec.rb
+4
-4
spec/finders/personal_projects_finder_spec.rb
spec/finders/personal_projects_finder_spec.rb
+7
-5
No files found.
app/finders/personal_projects_finder.rb
View file @
d8a9bfb6
...
...
@@ -13,7 +13,7 @@ class PersonalProjectsFinder < UnionFinder
def
execute
(
current_user
=
nil
)
segments
=
all_projects
(
current_user
)
find_union
(
segments
,
Project
).
includes
(
:namespace
).
order_
i
d_desc
find_union
(
segments
,
Project
).
includes
(
:namespace
).
order_
update
d_desc
end
private
...
...
changelogs/unreleased/45065-users-projects-json-sort.yml
0 → 100644
View file @
d8a9bfb6
---
title
:
Order UsersController#projects.json by updated_at
merge_request
:
18227
author
:
Takuya Noguchi
type
:
other
spec/features/users/user_browses_projects_on_user_page_spec.rb
View file @
d8a9bfb6
...
...
@@ -27,8 +27,8 @@ describe 'Users > User browses projects on user page', :js do
end
it
'paginates projects'
,
:js
do
project
=
create
(
:project
,
namespace:
user
.
namespace
)
project2
=
create
(
:project
,
namespace:
user
.
namespace
)
project
=
create
(
:project
,
namespace:
user
.
namespace
,
updated_at:
2
.
minutes
.
since
)
project2
=
create
(
:project
,
namespace:
user
.
namespace
,
updated_at:
1
.
minute
.
since
)
allow
(
Project
).
to
receive
(
:default_per_page
).
and_return
(
1
)
sign_in
(
user
)
...
...
@@ -41,11 +41,11 @@ describe 'Users > User browses projects on user page', :js do
wait_for_requests
expect
(
page
).
to
have_content
(
project
2
.
name
)
expect
(
page
).
to
have_content
(
project
.
name
)
click_link
(
'Next'
)
expect
(
page
).
to
have_content
(
project
.
name
)
expect
(
page
).
to
have_content
(
project
2
.
name
)
end
context
'when not signed in'
do
...
...
spec/finders/personal_projects_finder_spec.rb
View file @
d8a9bfb6
...
...
@@ -4,14 +4,16 @@ describe PersonalProjectsFinder do
let
(
:source_user
)
{
create
(
:user
)
}
let
(
:current_user
)
{
create
(
:user
)
}
let
(
:finder
)
{
described_class
.
new
(
source_user
)
}
let!
(
:public_project
)
{
create
(
:project
,
:public
,
namespace:
source_user
.
namespace
)
}
let!
(
:public_project
)
do
create
(
:project
,
:public
,
namespace:
source_user
.
namespace
,
updated_at:
1
.
hour
.
ago
)
end
let!
(
:private_project
)
do
create
(
:project
,
:private
,
namespace:
source_user
.
namespace
,
path:
'mepmep'
)
create
(
:project
,
:private
,
namespace:
source_user
.
namespace
,
updated_at:
3
.
hours
.
ago
,
path:
'mepmep'
)
end
let!
(
:internal_project
)
do
create
(
:project
,
:internal
,
namespace:
source_user
.
namespace
,
path:
'C'
)
create
(
:project
,
:internal
,
namespace:
source_user
.
namespace
,
updated_at:
2
.
hours
.
ago
,
path:
'C'
)
end
before
do
...
...
@@ -28,7 +30,7 @@ describe PersonalProjectsFinder do
subject
{
finder
.
execute
(
current_user
)
}
context
'normal user'
do
it
{
is_expected
.
to
eq
([
internal_project
,
private_project
,
public
_project
])
}
it
{
is_expected
.
to
eq
([
public_project
,
internal_project
,
private
_project
])
}
end
context
'external'
do
...
...
@@ -36,7 +38,7 @@ describe PersonalProjectsFinder do
current_user
.
update_attributes
(
external:
true
)
end
it
{
is_expected
.
to
eq
([
p
rivate_project
,
public
_project
])
}
it
{
is_expected
.
to
eq
([
p
ublic_project
,
private
_project
])
}
end
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