Schema Information

Table name: events

id          :integer          not null, primary key
target_type :string(255)
target_id   :integer
title       :string(255)
data        :text
project_id  :integer
created_at  :datetime         not null
updated_at  :datetime         not null
action      :integer
author_id   :integer
Methods
A
C
D
I
J
L
M
N
P
R
T
Included Modules
Constants
Created = 1
 
Updated = 2
 
Closed = 3
 
Reopened = 4
 
Pushed = 5
 
Commented = 6
 
Merged = 7
 
Joined = 8
 
Left = 9
 
Class Public methods
determine_action(record)
# File app/models/event.rb, line 53
def determine_action(record)
  if [Issue, MergeRequest].include? record.class
    Event::Created
  elsif record.kind_of? Note
    Event::Commented
  end
end
Instance Public methods
action_name()
# File app/models/event.rb, line 160
def action_name
  if closed?
    "closed"
  elsif merged?
    "merged"
  elsif joined?
    'joined'
  elsif left?
    'left'
  else
    "opened"
  end
end
author()
# File app/models/event.rb, line 156
def author
  @author ||= User.find(author_id)
end
changed_issue?()
# File app/models/event.rb, line 131
def changed_issue?
  target_type == "Issue" &&
    [Closed, Reopened].include?(action)
end
changed_merge_request?()
# File app/models/event.rb, line 126
def changed_merge_request?
  target_type == "MergeRequest" &&
    [Closed, Reopened].include?(action)
end
closed?()
# File app/models/event.rb, line 92
def closed?
  action == self.class::Closed
end
issue()
# File app/models/event.rb, line 148
def issue
  target if target_type == "Issue"
end
issue?()
# File app/models/event.rb, line 108
def issue?
  target_type == "Issue"
end
joined?()
# File app/models/event.rb, line 136
def joined?
  action == Joined
end
left?()
# File app/models/event.rb, line 140
def left?
  action == Left
end
membership_changed?()
# File app/models/event.rb, line 144
def membership_changed?
  joined? || left?
end
merge_request()
# File app/models/event.rb, line 152
def merge_request
  target if target_type == "MergeRequest"
end
merge_request?()
# File app/models/event.rb, line 112
def merge_request?
  target_type == "MergeRequest"
end
merged?()
# File app/models/event.rb, line 88
def merged?
  action == self.class::Merged
end
milestone?()
# File app/models/event.rb, line 100
def milestone?
  target_type == "Milestone"
end
new_issue?()
# File app/models/event.rb, line 116
def new_issue?
  target_type == "Issue" &&
    action == Created
end
new_merge_request?()
# File app/models/event.rb, line 121
def new_merge_request?
  target_type == "MergeRequest" &&
    action == Created
end
note?()
# File app/models/event.rb, line 104
def note?
  target_type == "Note"
end
project_name()
# File app/models/event.rb, line 72
def project_name
  if project
    project.name
  else
    "(deleted project)"
  end
end
proper?()
# File app/models/event.rb, line 62
def proper?
  if push?
    true
  elsif membership_changed?
    true
  else
    (issue? || merge_request? || note? || milestone?) && target
  end
end
push?()
# File app/models/event.rb, line 84
def push?
  action == self.class::Pushed && valid_push?
end
reopened?()
# File app/models/event.rb, line 96
def reopened?
  action == self.class::Reopened
end
target_title()
# File app/models/event.rb, line 80
def target_title
  target.try :title
end