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 ...@@ -13,5 +13,15 @@ module Emails
mail(to: @user.email, mail(to: @user.email,
subject: subject("Project was moved")) subject: subject("Project was moved"))
end 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
end end
...@@ -32,8 +32,16 @@ class EmailsOnPushService < Service ...@@ -32,8 +32,16 @@ class EmailsOnPushService < Service
'emails_on_push' 'emails_on_push'
end end
def execute def execute(push_data)
true 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 end
def fields def fields
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
- if type == 'text' - if type == 'text'
= f.text_field name, class: "input-xlarge", placeholder: placeholder = f.text_field name, class: "input-xlarge", placeholder: placeholder
- elsif type == 'textarea' - 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' - elsif type == 'checkbox'
= f.check_box name = 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