class Event

Constants

Closed
Commented
Created
Joined
Left
Merged
Pushed
Reopened
Updated

Public Class Methods

determine_action(record) click to toggle source
# File app/models/event.rb, line 36
def determine_action(record)
  if [Issue, MergeRequest].include? record.class
    Event::Created
  elsif record.kind_of? Note
    Event::Commented
  end
end

Public Instance Methods

action_name() click to toggle source
# File app/models/event.rb, line 133
def action_name
  if closed?
    "closed"
  elsif merged?
    "merged"
  elsif joined?
    'joined'
  elsif left?
    'left'
  else
    "opened"
  end
end
allowed?() click to toggle source

Next events currently enabled for system

- push
- new issue
- merge request
# File app/models/event.rb, line 49
def allowed?
  push? || issue? || merge_request? || membership_changed?
end
author() click to toggle source
# File app/models/event.rb, line 129
def author
  @author ||= User.find(author_id)
end
changed_issue?() click to toggle source
# File app/models/event.rb, line 104
def changed_issue?
  target_type == "Issue" &&
    [Closed, Reopened].include?(action)
end
changed_merge_request?() click to toggle source
# File app/models/event.rb, line 99
def changed_merge_request?
  target_type == "MergeRequest" &&
    [Closed, Reopened].include?(action)
end
closed?() click to toggle source
# File app/models/event.rb, line 73
def closed?
  action == self.class::Closed
end
issue() click to toggle source
# File app/models/event.rb, line 121
def issue
  target if target_type == "Issue"
end
issue?() click to toggle source
# File app/models/event.rb, line 81
def issue?
  target_type == "Issue"
end
joined?() click to toggle source
# File app/models/event.rb, line 109
def joined?
  action == Joined
end
left?() click to toggle source
# File app/models/event.rb, line 113
def left?
  action == Left
end
membership_changed?() click to toggle source
# File app/models/event.rb, line 117
def membership_changed?
  joined? || left?
end
merge_request() click to toggle source
# File app/models/event.rb, line 125
def merge_request
  target if target_type == "MergeRequest"
end
merge_request?() click to toggle source
# File app/models/event.rb, line 85
def merge_request?
  target_type == "MergeRequest"
end
merged?() click to toggle source
# File app/models/event.rb, line 69
def merged?
  action == self.class::Merged
end
new_issue?() click to toggle source
# File app/models/event.rb, line 89
def new_issue?
  target_type == "Issue" &&
    action == Created
end
new_merge_request?() click to toggle source
# File app/models/event.rb, line 94
def new_merge_request?
  target_type == "MergeRequest" &&
    action == Created
end
project_name() click to toggle source
# File app/models/event.rb, line 53
def project_name
  if project
    project.name
  else
    "(deleted project)"
  end
end
push?() click to toggle source
# File app/models/event.rb, line 65
def push?
  action == self.class::Pushed && valid_push?
end
reopened?() click to toggle source
# File app/models/event.rb, line 77
def reopened?
  action == self.class::Reopened
end
target_title() click to toggle source
# File app/models/event.rb, line 61
def target_title
  target.try :title
end