projects.rb 1.35 KB
Newer Older
1 2
module Emails
  module Projects
3
    def project_was_moved_email(project_id, user_id, old_path_with_namespace)
Douwe Maan's avatar
Douwe Maan committed
4
      @current_user = @user = User.find user_id
5
      @project = Project.find project_id
6
      @target_url = project_url(@project)
7
      @old_path_with_namespace = old_path_with_namespace
8
      mail(to: @user.notification_email,
9
           subject: subject("Project was moved"))
Douwe Maan's avatar
Douwe Maan committed
10 11
    end

12 13 14 15 16 17 18 19 20 21 22 23 24
    def project_was_exported_email(current_user, project)
      @project = project
      mail(to: current_user.notification_email,
           subject: subject("Project was exported"))
    end

    def project_was_not_exported_email(current_user, project, errors)
      @project = project
      @errors = errors
      mail(to: current_user.notification_email,
           subject: subject("Project export error"))
    end

25
    def repository_push_email(project_id, opts = {})
26
      @message =
27
        Gitlab::Email::Message::RepositoryPush.new(self, project_id, opts)
28

29 30
      # used in notify layout
      @target_url = @message.target_url
31 32
      @project = Project.find(project_id)
      @diff_notes_disabled = true
33 34 35

      add_project_headers
      headers['X-GitLab-Author'] = @message.author_username
36

37 38 39
      mail(from:      sender(@message.author_id, @message.send_from_committer_email?),
           reply_to:  @message.reply_to,
           subject:   @message.subject)
40
    end
41 42
  end
end