Module: Emails::MergeRequests

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

Instance Method Summary collapse

Instance Method Details

#changed_milestone_merge_request_email(recipient_id, merge_request_id, milestone, updated_by_user_id, reason = nil) ⇒ Object


51
52
53
54
55
56
57
58
59
# File 'app/mailers/emails/merge_requests.rb', line 51

def changed_milestone_merge_request_email(recipient_id, merge_request_id, milestone, updated_by_user_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  @milestone = milestone
  @milestone_url = milestone_url(@milestone)
  mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason).merge({
    template_name: 'changed_milestone_email'
  }))
end

#closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason: nil, closed_via: nil) ⇒ Object


61
62
63
64
65
66
# File 'app/mailers/emails/merge_requests.rb', line 61

def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason: nil, closed_via: nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  @updated_by = User.find(updated_by_user_id)
  mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end

#merge_request_status_email(recipient_id, merge_request_id, status, updated_by_user_id, reason = nil) ⇒ Object


74
75
76
77
78
79
80
# File 'app/mailers/emails/merge_requests.rb', line 74

def merge_request_status_email(recipient_id, merge_request_id, status, updated_by_user_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  @mr_status = status
  @updated_by = User.find(updated_by_user_id)
  mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end

#merge_request_unmergeable_email(recipient_id, merge_request_id, reason = nil) ⇒ Object


82
83
84
85
86
# File 'app/mailers/emails/merge_requests.rb', line 82

def merge_request_unmergeable_email(recipient_id, merge_request_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  mail_answer_thread(@merge_request, merge_request_thread_options(@merge_request.author_id, recipient_id, reason))
end

#merge_when_pipeline_succeeds_email(recipient_id, merge_request_id, mwps_set_by_user_id, reason = nil) ⇒ Object


95
96
97
98
99
100
# File 'app/mailers/emails/merge_requests.rb', line 95

def merge_when_pipeline_succeeds_email(recipient_id, merge_request_id, mwps_set_by_user_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  @mwps_set_by = ::User.find(mwps_set_by_user_id)
  mail_answer_thread(@merge_request, merge_request_thread_options(mwps_set_by_user_id, recipient_id, reason))
end

#merged_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason: nil, closed_via: nil) ⇒ Object


68
69
70
71
72
# File 'app/mailers/emails/merge_requests.rb', line 68

def merged_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason: nil, closed_via: nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end

#new_mention_in_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil) ⇒ Object


11
12
13
14
15
# File 'app/mailers/emails/merge_requests.rb', line 11

def new_mention_in_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id, present: true)

  mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end

#new_merge_request_email(recipient_id, merge_request_id, reason = nil) ⇒ Object


5
6
7
8
9
# File 'app/mailers/emails/merge_requests.rb', line 5

def new_merge_request_email(recipient_id, merge_request_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id, present: true)

  mail_new_thread(@merge_request, merge_request_thread_options(@merge_request.author_id, recipient_id, reason))
end

#push_to_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil, new_commits: [], existing_commits: []) ⇒ Object


17
18
19
20
21
22
23
24
# File 'app/mailers/emails/merge_requests.rb', line 17

def push_to_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil, new_commits: [], existing_commits: [])
  setup_merge_request_mail(merge_request_id, recipient_id)
  @new_commits = new_commits
  @existing_commits = existing_commits
  @updated_by_user = User.find(updated_by_user_id)

  mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end

#reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_ids, updated_by_user_id, reason = nil) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord


27
28
29
30
31
32
33
34
# File 'app/mailers/emails/merge_requests.rb', line 27

def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_ids, updated_by_user_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  @previous_assignees = []
  @previous_assignees = User.where(id: previous_assignee_ids) if previous_assignee_ids.any?

  mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end

#relabeled_merge_request_email(recipient_id, merge_request_id, label_names, updated_by_user_id, reason = nil) ⇒ Object

rubocop: enable CodeReuse/ActiveRecord


37
38
39
40
41
42
43
# File 'app/mailers/emails/merge_requests.rb', line 37

def relabeled_merge_request_email(recipient_id, merge_request_id, label_names, updated_by_user_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  @label_names = label_names
  @labels_url = project_labels_url(@project)
  mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end

#removed_milestone_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil) ⇒ Object


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

def removed_milestone_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end

#resolved_all_discussions_email(recipient_id, merge_request_id, resolved_by_user_id, reason = nil) ⇒ Object


88
89
90
91
92
93
# File 'app/mailers/emails/merge_requests.rb', line 88

def resolved_all_discussions_email(recipient_id, merge_request_id, resolved_by_user_id, reason = nil)
  setup_merge_request_mail(merge_request_id, recipient_id)

  @resolved_by = User.find(resolved_by_user_id)
  mail_answer_thread(@merge_request, merge_request_thread_options(resolved_by_user_id, recipient_id, reason))
end