simple refactoring
This commit is contained in:
parent
a635b9da97
commit
df7c52489a
21 changed files with 276 additions and 264 deletions
|
@ -27,19 +27,22 @@ class Event < ActiveRecord::Base
|
|||
# For Hash only
|
||||
serialize :data
|
||||
|
||||
# Scopes
|
||||
scope :recent, order("created_at DESC")
|
||||
scope :code_push, where(action: Pushed)
|
||||
|
||||
def self.determine_action(record)
|
||||
if [Issue, MergeRequest].include? record.class
|
||||
Event::Created
|
||||
elsif record.kind_of? Note
|
||||
Event::Commented
|
||||
class << self
|
||||
def determine_action(record)
|
||||
if [Issue, MergeRequest].include? record.class
|
||||
Event::Created
|
||||
elsif record.kind_of? Note
|
||||
Event::Commented
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.recent_for_user user
|
||||
where(project_id: user.projects.map(&:id)).recent
|
||||
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