summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-05-18 17:13:54 -0500
committerRémy Coutable <remy@rymai.me>2016-05-18 17:13:54 -0500
commit958ff11f971823aa11ac547d7e83ccf9603566d3 (patch)
tree277dc0db983ca426d767c3065487e818d7577b69
parent7254fb9e2bd4e03df7f2e9f1cde5293b5f8e40c5 (diff)
downloadgitlab-ce-17635-remove-unused-project-scopes.tar.gz
Remove unused Project scopes17635-remove-unused-project-scopes
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--app/models/project.rb30
1 files changed, 5 insertions, 25 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 2a6b0839b64..907d80c0681 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -171,17 +171,17 @@ class Project < ActiveRecord::Base
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') }
- 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_group_namespace, -> { joins(:group) }
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 }
+ 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 @@ class Project < ActiveRecord::Base
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 @@ class Project < ActiveRecord::Base
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 @@ class Project < ActiveRecord::Base
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