diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-05 13:11:15 +0200 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-05 13:11:15 +0200 |
| commit | 5a214ee6f198a90f41a54b3dd7f2ff6a318a8deb (patch) | |
| tree | cd1f0645953fede0a55e9ab55e7a29f41480c983 /app/models | |
| parent | e3d7ce2cc482a730b2dc63ca09057b22a960b998 (diff) | |
| download | gitlab-ce-5a214ee6f198a90f41a54b3dd7f2ff6a318a8deb.tar.gz | |
Remove unused methods
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/commit.rb | 4 | ||||
| -rw-r--r-- | app/models/note.rb | 8 | ||||
| -rw-r--r-- | app/models/project.rb | 12 | ||||
| -rw-r--r-- | app/models/user.rb | 4 | ||||
| -rw-r--r-- | app/models/users_project.rb | 26 | ||||
| -rw-r--r-- | app/models/wiki.rb | 1 |
6 files changed, 4 insertions, 51 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 7e64c0f6e82..17d41f27f34 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -149,10 +149,6 @@ class Commit prev_commit.try :id end - def parents_count - parents && parents.count || 0 - end - # Shows the diff between the commit's parent and the commit. # # Cuts out the header and stats from #to_patch and returns only the diff. diff --git a/app/models/note.rb b/app/models/note.rb index abd89a8a46e..b055ae623b2 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -42,11 +42,11 @@ class Note < ActiveRecord::Base mount_uploader :attachment, AttachmentUploader # Scopes - scope :for_commits, ->{ where(noteable_type: "Commit") } + scope :for_commit_id, ->(commit_id) { where(noteable_type: "Commit", commit_id: commit_id) } + scope :inline, where("line_code IS NOT NULL") + scope :not_inline, where("line_code IS NULL") + scope :common, ->{ where(noteable_type: ["", nil]) } - scope :today, ->{ where("created_at >= :date", date: Date.today) } - scope :last_week, ->{ where("created_at >= :date", date: (Date.today - 7.days)) } - scope :since, ->(day) { where("created_at >= :date", date: (day)) } scope :fresh, ->{ order("created_at ASC, id ASC") } scope :inc_author_project, ->{ includes(:project, :author) } scope :inc_author, ->{ includes(:author) } diff --git a/app/models/project.rb b/app/models/project.rb index 2204d4a56e5..702f4b2bf81 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -83,10 +83,6 @@ class Project < ActiveRecord::Base scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) } class << self - def authorized_for user - raise "DERECATED" - end - def active joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC") end @@ -215,14 +211,6 @@ class Project < ActiveRecord::Base notes.new(commit_id: commit.id, noteable_type: "Commit") end - def commit_notes(commit) - notes.where(commit_id: commit.id, noteable_type: "Commit", line_code: nil) - end - - def commit_line_notes(commit) - notes.where(commit_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL") - end - def last_activity last_event end diff --git a/app/models/user.rb b/app/models/user.rb index 5e4815da865..341b96a0d91 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -230,10 +230,6 @@ class User < ActiveRecord::Base abilities.allowed?(self, action, subject) end - def last_activity_project - projects.first - end - def first_name name.split.first unless name.blank? end diff --git a/app/models/users_project.rb b/app/models/users_project.rb index 362b1a5d8e5..79146289836 100644 --- a/app/models/users_project.rb +++ b/app/models/users_project.rb @@ -106,28 +106,6 @@ class UsersProject < ActiveRecord::Base truncate_teams [project.id] end - def bulk_delete(project, user_ids) - UsersProject.transaction do - UsersProject.where(user_id: user_ids, project_id: project.id).each do |users_project| - users_project.skip_git = true - users_project.destroy - end - - project.update_repository - end - end - - def bulk_update(project, user_ids, project_access) - UsersProject.transaction do - UsersProject.where(user_id: user_ids, project_id: project.id).each do |users_project| - users_project.project_access = project_access - users_project.skip_git = true - users_project.save - end - project.update_repository - end - end - def roles_hash { guest: GUEST, @@ -147,10 +125,6 @@ class UsersProject < ActiveRecord::Base end end - def role_access - project_access - end - def update_repository gitolite.update_repository(project) end diff --git a/app/models/wiki.rb b/app/models/wiki.rb index 252a97e8cca..4f113957f99 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -50,5 +50,4 @@ class Wiki < ActiveRecord::Base def set_slug self.slug = self.title.parameterize end - end |
