notify.rb 1.2 KB
Newer Older
G
gitlabhq 已提交
1 2 3 4 5 6 7
class Notify < ActionMailer::Base
  default_url_options[:host] = "gitlabhq.com"
  default from: "notify@gitlabhq.com"

  def new_user_email(user, password)
    @user = user
    @password = password
8
    mail(:to => @user.email, :subject => "gitlab | Account was created for you", :from => EMAIL_OPTS["from"])
G
gitlabhq 已提交
9 10 11 12 13 14 15
  end

  def new_issue_email(issue)
    @user = issue.assignee
    @project = issue.project
    @issue = issue

16
    mail(:to => @user.email, :subject => "gitlab | New Issue was created", :from => EMAIL_OPTS["from"])
G
gitlabhq 已提交
17 18 19 20 21 22
  end

  def note_wall_email(user, note)
    @user = user
    @note = note
    @project = note.project
23
    mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ", :from => EMAIL_OPTS["from"])
G
gitlabhq 已提交
24 25 26 27 28 29 30
  end

  def note_commit_email(user, note)
    @user = user
    @note = note
    @project = note.project
    @commit = @project.repo.commits(note.noteable_id).first
31
    mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ", :from => EMAIL_OPTS["from"])
G
gitlabhq 已提交
32 33 34 35 36 37 38
  end

  def note_issue_email(user, note)
    @user = user
    @note = note
    @project = note.project
    @issue = note.noteable
39
    mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ", :from => EMAIL_OPTS["from"])
G
gitlabhq 已提交
40 41
  end
end