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
958ff11f
Commit
958ff11f
authored
May 18, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused Project scopes
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
7254fb9e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
25 deletions
+5
-25
app/models/project.rb
app/models/project.rb
+5
-25
No files found.
app/models/project.rb
View file @
958ff11f
...
@@ -171,17 +171,17 @@ class Project < ActiveRecord::Base
...
@@ -171,17 +171,17 @@ class Project < ActiveRecord::Base
scope
:sorted_by_activity
,
->
{
reorder
(
last_activity_at: :desc
)
}
scope
:sorted_by_activity
,
->
{
reorder
(
last_activity_at: :desc
)
}
scope
:sorted_by_stars
,
->
{
reorder
(
'projects.star_count DESC'
)
}
scope
:sorted_by_stars
,
->
{
reorder
(
'projects.star_count DESC'
)
}
scope
:sorted_by_names
,
->
{
joins
(
:namespace
).
reorder
(
'namespaces.name ASC, projects.name ASC'
)
}
scope
:without_user
,
->
(
user
)
{
where
(
'projects.id NOT IN (:ids)'
,
ids:
user
.
authorized_projects
.
map
(
&
:id
)
)
}
scope
:without_team
,
->
(
team
)
{
team
.
projects
.
present?
?
where
(
'projects.id NOT IN (:ids)'
,
ids:
team
.
projects
.
map
(
&
:id
))
:
scoped
}
scope
:not_in_group
,
->
(
group
)
{
where
(
'projects.id NOT IN (:ids)'
,
ids:
group
.
project_ids
)
}
scope
:in_namespace
,
->
(
namespace_ids
)
{
where
(
namespace_id:
namespace_ids
)
}
scope
:in_namespace
,
->
(
namespace_ids
)
{
where
(
namespace_id:
namespace_ids
)
}
scope
:in_group_namespace
,
->
{
joins
(
:group
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
'namespace_id != ?'
,
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
'namespace_id != ?'
,
user
.
namespace_id
)
}
scope
:visible_to_user
,
->
(
user
)
{
where
(
id:
user
.
authorized_projects
.
select
(
:id
).
reorder
(
nil
))
}
scope
:non_archived
,
->
{
where
(
archived:
false
)
}
scope
:non_archived
,
->
{
where
(
archived:
false
)
}
scope
:for_milestones
,
->
(
ids
)
{
joins
(
:milestones
).
where
(
'milestones.id'
=>
ids
).
distinct
}
scope
:for_milestones
,
->
(
ids
)
{
joins
(
:milestones
).
where
(
'milestones.id'
=>
ids
).
distinct
}
scope
:with_push
,
->
{
joins
(
:events
).
where
(
'events.action = ?'
,
Event
::
PUSHED
)
}
scope
:active
,
->
{
joins
(
:issues
,
:notes
,
:merge_requests
).
order
(
'issues.created_at, notes.created_at, merge_requests.created_at DESC'
)
}
scope
:abandoned
,
->
{
where
(
'projects.last_activity_at < ?'
,
6
.
months
.
ago
)
}
state_machine
:import_status
,
initial: :none
do
state_machine
:import_status
,
initial: :none
do
event
:import_start
do
event
:import_start
do
...
@@ -208,18 +208,6 @@ class Project < ActiveRecord::Base
...
@@ -208,18 +208,6 @@ class Project < ActiveRecord::Base
end
end
class
<<
self
class
<<
self
def
abandoned
where
(
'projects.last_activity_at < ?'
,
6
.
months
.
ago
)
end
def
with_push
joins
(
:events
).
where
(
'events.action = ?'
,
Event
::
PUSHED
)
end
def
active
joins
(
:issues
,
:notes
,
:merge_requests
).
order
(
'issues.created_at, notes.created_at, merge_requests.created_at DESC'
)
end
# Searches for a list of projects based on the query given in `query`.
# Searches for a list of projects based on the query given in `query`.
#
#
# On PostgreSQL this method uses "ILIKE" to perform a case-insensitive
# On PostgreSQL this method uses "ILIKE" to perform a case-insensitive
...
@@ -281,10 +269,6 @@ class Project < ActiveRecord::Base
...
@@ -281,10 +269,6 @@ class Project < ActiveRecord::Base
projects
.
iwhere
(
'projects.path'
=>
project_path
).
take
projects
.
iwhere
(
'projects.path'
=>
project_path
).
take
end
end
def
find_by_ci_id
(
id
)
find_by
(
ci_id:
id
.
to_i
)
end
def
visibility_levels
def
visibility_levels
Gitlab
::
VisibilityLevel
.
options
Gitlab
::
VisibilityLevel
.
options
end
end
...
@@ -315,10 +299,6 @@ class Project < ActiveRecord::Base
...
@@ -315,10 +299,6 @@ class Project < ActiveRecord::Base
joins
(
join_body
).
reorder
(
'join_note_counts.amount DESC'
)
joins
(
join_body
).
reorder
(
'join_note_counts.amount DESC'
)
end
end
def
visible_to_user
(
user
)
where
(
id:
user
.
authorized_projects
.
select
(
:id
).
reorder
(
nil
))
end
end
end
def
team
def
team
...
...
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