Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
59964c6633e8
Commit
59964c66
authored
May 18, 2016
by
Rémy Coutable
Browse files
Remove unused Project scopes
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
23266e265828
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/models/project.rb
View file @
59964c66
...
...
@@ -171,5 +171,4 @@
scope
:sorted_by_activity
,
->
{
reorder
(
last_activity_at: :desc
)
}
scope
:sorted_by_stars
,
->
{
reorder
(
'projects.star_count DESC'
)
}
scope
:sorted_by_names
,
->
{
joins
(
:namespace
).
reorder
(
'namespaces.name ASC, projects.name ASC'
)
}
...
...
@@ -175,5 +174,2 @@
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
)
}
...
...
@@ -179,4 +175,3 @@
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
:joined
,
->
(
user
)
{
where
(
'namespace_id != ?'
,
user
.
namespace_id
)
}
...
...
@@ -181,4 +176,5 @@
scope
:personal
,
->
(
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
:for_milestones
,
->
(
ids
)
{
joins
(
:milestones
).
where
(
'milestones.id'
=>
ids
).
distinct
}
...
...
@@ -183,5 +179,9 @@
scope
:non_archived
,
->
{
where
(
archived:
false
)
}
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
event
:import_start
do
...
...
@@ -208,18 +208,6 @@
end
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`.
#
# On PostgreSQL this method uses "ILIKE" to perform a case-insensitive
...
...
@@ -281,10 +269,6 @@
projects
.
iwhere
(
'projects.path'
=>
project_path
).
take
end
def
find_by_ci_id
(
id
)
find_by
(
ci_id:
id
.
to_i
)
end
def
visibility_levels
Gitlab
::
VisibilityLevel
.
options
end
...
...
@@ -315,10 +299,6 @@
joins
(
join_body
).
reorder
(
'join_note_counts.amount DESC'
)
end
def
visible_to_user
(
user
)
where
(
id:
user
.
authorized_projects
.
select
(
:id
).
reorder
(
nil
))
end
end
def
team
...
...
Write
Preview
Supports
Markdown
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