projects.rb 995 Bytes
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
Vinnie Okada's avatar
Vinnie Okada committed
6
      @target_url = namespace_project_url(@project.namespace, @project)
7
      @old_path_with_namespace = old_path_with_namespace
8
      mail(to: @user.notification_email,
9
           subject: subject("Project was moved"))
10
    end
11

12
    def repository_push_email(project_id, opts = {})
13
      @message =
14
        Gitlab::Email::Message::RepositoryPush.new(self, project_id, opts)
15

16 17
      # used in notify layout
      @target_url = @message.target_url
18 19 20
      @project = Project.find(project_id)

      @diff_notes_disabled = true
21 22 23

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

25 26 27
      mail(from:      sender(@message.author_id, @message.send_from_committer_email?),
           reply_to:  @message.reply_to,
           subject:   @message.subject)
28
    end
29 30
  end
end