forked from Trustie/forgeplus
34 lines
846 B
Ruby
34 lines
846 B
Ruby
# == Schema Information
|
|
#
|
|
# Table name: project_actions
|
|
#
|
|
# id :integer not null, primary key
|
|
# project_id :integer
|
|
# type :string(255)
|
|
# user_id :integer
|
|
# event_extra :text(65535)
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_project_actions_on_project_id (project_id)
|
|
#
|
|
|
|
|
|
class ProjectActions::IssuesEvent < ProjectAction
|
|
def self.build(project, user, issue, action)
|
|
project_action = new(project: project, user: user)
|
|
project_action.event_extra = {
|
|
issue_id: issue.id,
|
|
issue_number: issue.project_issues_index,
|
|
issue_author_id: issue.author_id,
|
|
issue_author_login: issue.user.login,
|
|
title: issue.subject,
|
|
body: issue.description,
|
|
action: action
|
|
}.as_json
|
|
project_action.save!
|
|
end
|
|
end
|