Commit d5509339 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add new method to mailer for deliver emails with push info

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 2428a0b2
......@@ -13,5 +13,15 @@ module Emails
mail(to: @user.email,
subject: subject("Project was moved"))
end
def repository_push_email(project_id, recipient, branch, compare)
@project = Project.find project_id
@commits = compare.commits
@commit = compare.commit
@diffs = compare.diffs
@branch = branch
mail(to: recipient, subject: subject("New push to repository"))
end
end
end
......@@ -32,8 +32,16 @@ class EmailsOnPushService < Service
'emails_on_push'
end
def execute
true
def execute(push_data)
before_sha = push_data[:before]
after_sha = push_data[:after]
branch = push_data[:ref]
compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha)
recipients.split(" ").each do |recipient|
Notify.delay.repository_push_email(project_id, recipient, branch, compare)
end
end
def fields
......
......@@ -34,7 +34,7 @@
- if type == 'text'
= f.text_field name, class: "input-xlarge", placeholder: placeholder
- elsif type == 'textarea'
= f.text_area name, rows: 5, class: "input-xlarge", placeholder: placeholder
= f.text_area name, rows: 5, class: "input-xxlarge", placeholder: placeholder
- elsif type == 'checkbox'
= f.check_box name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment