2011-10-08 23:36:38 +02:00
|
|
|
class Notify < ActionMailer::Base
|
2011-11-25 19:50:27 +01:00
|
|
|
default_url_options[:host] = EMAIL_OPTS["host"]
|
|
|
|
default from: EMAIL_OPTS["from"]
|
2011-10-08 23:36:38 +02:00
|
|
|
|
|
|
|
def new_user_email(user, password)
|
|
|
|
@user = user
|
|
|
|
@password = password
|
2011-11-25 19:50:27 +01:00
|
|
|
mail(:to => @user.email, :subject => "gitlab | Account was created for you")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def new_issue_email(issue)
|
|
|
|
@user = issue.assignee
|
|
|
|
@project = issue.project
|
|
|
|
@issue = issue
|
|
|
|
|
2011-11-25 19:50:27 +01:00
|
|
|
mail(:to => @user.email, :subject => "gitlab | New Issue was created")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def note_wall_email(user, note)
|
|
|
|
@user = user
|
|
|
|
@note = note
|
|
|
|
@project = note.project
|
2011-11-25 19:50:27 +01:00
|
|
|
mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def note_commit_email(user, note)
|
|
|
|
@user = user
|
|
|
|
@note = note
|
|
|
|
@project = note.project
|
|
|
|
@commit = @project.repo.commits(note.noteable_id).first
|
2011-12-24 17:28:20 +01:00
|
|
|
return unless ( note.notify or ( note.notify_author and @commit.author.email == @user.email ) )
|
2011-11-25 19:50:27 +01:00
|
|
|
mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ")
|
2011-12-18 15:29:58 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def note_merge_request_email(user, note)
|
|
|
|
@user = user
|
|
|
|
@note = note
|
|
|
|
@project = note.project
|
|
|
|
@merge_request = note.noteable
|
|
|
|
mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def note_issue_email(user, note)
|
|
|
|
@user = user
|
|
|
|
@note = note
|
|
|
|
@project = note.project
|
|
|
|
@issue = note.noteable
|
2011-11-25 19:50:27 +01:00
|
|
|
mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
2011-12-17 17:07:28 +01:00
|
|
|
|
|
|
|
def new_merge_request_email(merge_request)
|
|
|
|
@user = merge_request.assignee
|
|
|
|
@merge_request = merge_request
|
|
|
|
@project = merge_request.project
|
|
|
|
mail(:to => @user.email, :subject => "gitlab | #{@merge_request.title} ")
|
|
|
|
end
|
2011-12-18 14:46:06 +01:00
|
|
|
|
|
|
|
def changed_merge_request_email(user, merge_request)
|
|
|
|
@user = user
|
|
|
|
@assignee_was ||= User.find(merge_request.assignee_id_was)
|
|
|
|
@merge_request = merge_request
|
|
|
|
@project = merge_request.project
|
|
|
|
mail(:to => @user.email, :subject => "gitlab | #{@merge_request.title} ")
|
|
|
|
end
|
2011-12-18 15:07:47 +01:00
|
|
|
|
|
|
|
def changed_issue_email(user, issue)
|
|
|
|
@user = user
|
|
|
|
@assignee_was ||= User.find(issue.assignee_id_was)
|
|
|
|
@issue = issue
|
|
|
|
@project = issue.project
|
|
|
|
mail(:to => @user.email, :subject => "gitlab | #{@issue.title} ")
|
|
|
|
end
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|