Context refactoring. Move Issues list, Search logic to context
This commit is contained in:
parent
63fe042d97
commit
679d0d6d76
15 changed files with 100 additions and 83 deletions
|
@ -30,6 +30,7 @@ class Event < ActiveRecord::Base
|
|||
# Scopes
|
||||
scope :recent, order("created_at DESC")
|
||||
scope :code_push, where(action: Pushed)
|
||||
scope :in_projects, ->(project_ids) { where(project_id: project_ids).recent }
|
||||
|
||||
class << self
|
||||
def determine_action(record)
|
||||
|
@ -39,10 +40,6 @@ class Event < ActiveRecord::Base
|
|||
Event::Commented
|
||||
end
|
||||
end
|
||||
|
||||
def recent_for_user user
|
||||
where(project_id: user.projects.map(&:id)).recent
|
||||
end
|
||||
end
|
||||
|
||||
# Next events currently enabled for system
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue