Module: Emails::Projects

Included in:
Notify
Defined in:
app/mailers/emails/projects.rb

Instance Method Summary collapse

Instance Method Details

#inactive_project_deletion_warning_email(project, user, deletion_date) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
# File 'app/mailers/emails/projects.rb', line 82

def inactive_project_deletion_warning_email(project, user, deletion_date)
  @project = project
  @user = user
  @deletion_date = deletion_date
  subject_text = "Action required: Project #{project.name} is scheduled to be deleted on " \
  "#{deletion_date} due to inactivity"

  email_with_layout(
    to: user.notification_email_for(project.group),
    subject: subject(subject_text))
end

#project_was_exported_email(current_user, project) ⇒ Object



16
17
18
19
20
21
22
# File 'app/mailers/emails/projects.rb', line 16

def project_was_exported_email(current_user, project)
  @project = project
  mail_with_locale(
    to: current_user.notification_email_for(project.group),
    subject: subject("Project was exported")
  )
end

#project_was_moved_email(project_id, user_id, old_path_with_namespace) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'app/mailers/emails/projects.rb', line 5

def project_was_moved_email(project_id, user_id, old_path_with_namespace)
  @current_user = @user = User.find user_id
  @project = Project.find project_id
  @target_url = project_url(@project)
  @old_path_with_namespace = old_path_with_namespace
  mail_with_locale(
    to: @user.notification_email_for(@project.group),
    subject: subject("Project was moved")
  )
end

#project_was_not_exported_email(current_user, project, errors) ⇒ Object



24
25
26
27
28
29
30
31
# File 'app/mailers/emails/projects.rb', line 24

def project_was_not_exported_email(current_user, project, errors)
  @project = project
  @errors = errors
  mail_with_locale(
    to: current_user.notification_email_for(@project.group),
    subject: subject("Project export error")
  )
end

#prometheus_alert_fired_email(project, user, alert) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
# File 'app/mailers/emails/projects.rb', line 70

def prometheus_alert_fired_email(project, user, alert)
  @project = project
  @alert = alert.present
  @incident = alert.issue

  add_project_headers
  add_alert_headers

  subject_text = "Alert: #{@alert.email_title}"
  mail_with_locale(to: user.notification_email_for(@project.group), subject: subject(subject_text))
end

#repository_cleanup_failure_email(project, user, error) ⇒ Object



43
44
45
46
47
48
49
# File 'app/mailers/emails/projects.rb', line 43

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

  mail_with_locale(to: user.notification_email_for(project.group), subject: subject("Project cleanup failure"))
end

#repository_cleanup_success_email(project, user) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'app/mailers/emails/projects.rb', line 33

def repository_cleanup_success_email(project, user)
  @project = project
  @user = user

  mail_with_locale(
    to: user.notification_email_for(project.group),
    subject: subject("Project cleanup has completed")
  )
end

#repository_push_email(project_id, opts = {}) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'app/mailers/emails/projects.rb', line 51

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

  # used in notify layout
  @target_url = @message.target_url
  @project = Project.find(project_id)
  @diff_notes_disabled = true

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

  mail_with_locale(
    from: sender(@message.author_id, send_from_user_email: @message.send_from_committer_email?),
    reply_to: @message.reply_to,
    subject: @message.subject
  )
end