Read about our upcoming Code of Conduct on this issue

projects.rb 1.8 KB
Newer Older
gfyoung's avatar
gfyoung committed
1
2
# frozen_string_literal: true

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

14
15
16
17
18
19
20
21
22
23
24
25
26
    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

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    def repository_cleanup_success_email(project, user)
      @project = project
      @user = user

      mail(to: user.notification_email, subject: subject("Project cleanup has completed"))
    end

    def repository_cleanup_failure_email(project, user, error)
      @project = project
      @user = user
      @error = error

      mail(to: user.notification_email, subject: subject("Project cleanup failure"))
    end

42
    def repository_push_email(project_id, opts = {})
43
      @message =
44
        Gitlab::Email::Message::RepositoryPush.new(self, project_id, opts)
45

46
47
      # used in notify layout
      @target_url = @message.target_url
48
49
      @project = Project.find(project_id)
      @diff_notes_disabled = true
50
51
52

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

54
55
56
      mail(from:      sender(@message.author_id, @message.send_from_committer_email?),
           reply_to:  @message.reply_to,
           subject:   @message.subject)
57
    end
58
59
  end
end