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
iv
gitlab-ce
Commits
11797df1
Commit
11797df1
authored
Jan 18, 2016
by
Josh Frye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change 'public' flag to more robust 'visibility' query.
parent
6951396d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
8 deletions
+12
-8
CHANGELOG
CHANGELOG
+1
-1
app/models/project.rb
app/models/project.rb
+4
-0
doc/api/groups.md
doc/api/groups.md
+1
-1
doc/api/projects.md
doc/api/projects.md
+4
-4
lib/api/helpers.rb
lib/api/helpers.rb
+2
-2
No files found.
CHANGELOG
View file @
11797df1
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 8.5.0 (unreleased)
v 8.5.0 (unreleased)
- Add "
public
" flag to GET /projects api endpoint
- Add "
visibility
" flag to GET /projects api endpoint
v 8.4.0 (unreleased)
v 8.4.0 (unreleased)
- Ensure Gravatar host looks like an actual host
- Ensure Gravatar host looks like an actual host
...
...
app/models/project.rb
View file @
11797df1
...
@@ -272,6 +272,10 @@ class Project < ActiveRecord::Base
...
@@ -272,6 +272,10 @@ class Project < ActiveRecord::Base
query:
"%
#{
query
.
try
(
:downcase
)
}
%"
)
query:
"%
#{
query
.
try
(
:downcase
)
}
%"
)
end
end
def
search_by_visibility
(
level
)
where
(
visibility_level:
visibility_levels
[
level
.
capitalize
])
end
def
search_by_title
(
query
)
def
search_by_title
(
query
)
where
(
'projects.archived = ?'
,
false
).
where
(
'LOWER(projects.name) LIKE :query'
,
query:
"%
#{
query
.
downcase
}
%"
)
where
(
'projects.archived = ?'
,
false
).
where
(
'LOWER(projects.name) LIKE :query'
,
query:
"%
#{
query
.
downcase
}
%"
)
end
end
...
...
doc/api/groups.md
View file @
11797df1
...
@@ -33,7 +33,7 @@ GET /groups/:id/projects
...
@@ -33,7 +33,7 @@ GET /groups/:id/projects
Parameters:
Parameters:
-
`archived`
(optional) - if passed, limit by archived status
-
`archived`
(optional) - if passed, limit by archived status
-
`
public`
(optional) - if passed, limit by public visibility
-
`
visibility`
(optional) - if passed, limit by visibility
`public`
,
`internal`
,
`private`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`search`
(optional) - Return list of authorized projects according to a search criteria
-
`search`
(optional) - Return list of authorized projects according to a search criteria
...
...
doc/api/projects.md
View file @
11797df1
...
@@ -29,7 +29,7 @@ GET /projects
...
@@ -29,7 +29,7 @@ GET /projects
Parameters:
Parameters:
-
`archived`
(optional) - if passed, limit by archived status
-
`archived`
(optional) - if passed, limit by archived status
-
`
public`
(optional) - if passed, limit by public visibility
-
`
visibility`
(optional) - if passed, limit by visibility
`public`
,
`internal`
,
`private`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`search`
(optional) - Return list of authorized projects according to a search criteria
-
`search`
(optional) - Return list of authorized projects according to a search criteria
...
@@ -153,7 +153,7 @@ GET /projects/owned
...
@@ -153,7 +153,7 @@ GET /projects/owned
Parameters:
Parameters:
-
`archived`
(optional) - if passed, limit by archived status
-
`archived`
(optional) - if passed, limit by archived status
-
`
public`
(optional) - if passed, limit by public visibility
-
`
visibility`
(optional) - if passed, limit by visibility
`public`
,
`internal`
,
`private`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`search`
(optional) - Return list of authorized projects according to a search criteria
-
`search`
(optional) - Return list of authorized projects according to a search criteria
...
@@ -169,7 +169,7 @@ GET /projects/starred
...
@@ -169,7 +169,7 @@ GET /projects/starred
Parameters:
Parameters:
-
`archived`
(optional) - if passed, limit by archived status
-
`archived`
(optional) - if passed, limit by archived status
-
`
public`
(optional) - if passed, limit by public visibility
-
`
visibility`
(optional) - if passed, limit by visibility
`public`
,
`internal`
,
`private`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`search`
(optional) - Return list of authorized projects according to a search criteria
-
`search`
(optional) - Return list of authorized projects according to a search criteria
...
@@ -185,7 +185,7 @@ GET /projects/all
...
@@ -185,7 +185,7 @@ GET /projects/all
Parameters:
Parameters:
-
`archived`
(optional) - if passed, limit by archived status
-
`archived`
(optional) - if passed, limit by archived status
-
`
public`
(optional) - if passed, limit by public visibility
-
`
visibility`
(optional) - if passed, limit by visibility
`public`
,
`internal`
,
`private`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`search`
(optional) - Return list of authorized projects according to a search criteria
-
`search`
(optional) - Return list of authorized projects according to a search criteria
...
...
lib/api/helpers.rb
View file @
11797df1
...
@@ -264,8 +264,8 @@ module API
...
@@ -264,8 +264,8 @@ module API
projects
=
projects
.
search
(
params
[
:search
])
projects
=
projects
.
search
(
params
[
:search
])
end
end
if
params
[
:
public
].
present?
&&
parse_boolean
(
params
[
:public
])
if
params
[
:
visibility
].
present?
projects
=
projects
.
public_only
projects
=
projects
.
search_by_visibility
(
params
[
:visibility
])
end
end
projects
.
reorder
(
project_order_by
=>
project_sort
)
projects
.
reorder
(
project_order_by
=>
project_sort
)
...
...
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