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
16d530b7
Unverified
Commit
16d530b7
authored
Sep 25, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort projects in search autocomplete by amount of stars. Most popular go first
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
143b9363
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
1 deletion
+4
-1
CHANGELOG
CHANGELOG
+1
-0
search_helper.rb
app/helpers/search_helper.rb
+2
-1
project.rb
app/models/project.rb
+1
-0
No files found.
CHANGELOG
View file @
16d530b7
...
...
@@ -4,6 +4,7 @@ v 7.4.0
- Improve error reporting on users API (Julien Bianchi)
- Refactor test coverage tools usage. Use SIMPLECOV=true to generate it locally
- Increase unicorn timeout to 60 seconds
- Sort search autocomplete projects by stars count so most popular go first
v 7.3.1
- Fix ref parsing in Gitlab::GitAccess
...
...
app/helpers/search_helper.rb
View file @
16d530b7
...
...
@@ -80,7 +80,8 @@ module SearchHelper
# Autocomplete results for the current user's projects
def
projects_autocomplete
(
term
,
limit
=
5
)
ProjectsFinder
.
new
.
execute
(
current_user
).
search_by_title
(
term
).
non_archived
.
limit
(
limit
).
map
do
|
p
|
ProjectsFinder
.
new
.
execute
(
current_user
).
search_by_title
(
term
).
sorted_by_stars
.
non_archived
.
limit
(
limit
).
map
do
|
p
|
{
label:
"project:
#{
search_result_sanitize
(
p
.
name_with_namespace
)
}
"
,
url:
project_path
(
p
)
...
...
app/models/project.rb
View file @
16d530b7
...
...
@@ -122,6 +122,7 @@ class Project < ActiveRecord::Base
scope
:in_namespace
,
->
(
namespace
)
{
where
(
namespace_id:
namespace
.
id
)
}
scope
:in_group_namespace
,
->
{
joins
(
:group
)
}
scope
:sorted_by_activity
,
->
{
reorder
(
"projects.last_activity_at DESC"
)
}
scope
:sorted_by_stars
,
->
{
reorder
(
"projects.star_count DESC"
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
"namespace_id != ?"
,
user
.
namespace_id
)
}
scope
:public_only
,
->
{
where
(
visibility_level:
Project
::
PUBLIC
)
}
...
...
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