diff options
author | Pierre de La Morinerie <pierre@capitainetrain.com> | 2014-02-17 20:08:13 +0400 |
---|---|---|
committer | Pierre de La Morinerie <pierre@capitainetrain.com> | 2014-02-19 21:25:18 +0400 |
commit | 57cb1ca7917f27f2c7500858fb66d53b3ea49783 (patch) | |
tree | 3dc72881caa4cb57b72574fb74862d4987434394 /app/mailers | |
parent | d8a24003cbd66dc80393dae46299c5734d50b5e0 (diff) |
Write the issue/merge request title in the notification email subject
This changes the email subjects for issues and merge request
notifications from:
Team / Project | Note for issue #1234
to:
Team / Project | Saving issue doesn't work sometimes (#1234)
Rationale:
* Scan the subject of the email notification more easily when catching
up with a lot of notifications. Instead of having to open the email to
get the title of the issue or merge request, one can simply read the
subject of the email.
* Group messages by subject: email clients will group emails in threads
if they have the same subject.
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/issues.rb | 10 | ||||
-rw-r--r-- | app/mailers/emails/merge_requests.rb | 12 | ||||
-rw-r--r-- | app/mailers/emails/notes.rb | 12 |
3 files changed, 22 insertions, 12 deletions
diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb index b2b4b83d6c3..dece5112c9e 100644 --- a/app/mailers/emails/issues.rb +++ b/app/mailers/emails/issues.rb @@ -3,14 +3,16 @@ module Emails def new_issue_email(recipient_id, issue_id) @issue = Issue.find(issue_id) @project = @issue.project - mail(to: recipient(recipient_id), subject: subject("New issue ##{@issue.iid}", @issue.title)) + mail(to: recipient(recipient_id), + subject: subject("#{@issue.title} (##{@issue.iid})")) end def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id) @issue = Issue.find(issue_id) @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id @project = @issue.project - mail(to: recipient(recipient_id), subject: subject("Changed issue ##{@issue.iid}", @issue.title)) + mail(to: recipient(recipient_id), + subject: subject("#{@issue.title} (##{@issue.iid})")) end def closed_issue_email(recipient_id, issue_id, updated_by_user_id) @@ -18,7 +20,7 @@ module Emails @project = @issue.project @updated_by = User.find updated_by_user_id mail(to: recipient(recipient_id), - subject: subject("Closed issue ##{@issue.iid}", @issue.title)) + subject: subject("#{@issue.title} (##{@issue.iid})")) end def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id) @@ -27,7 +29,7 @@ module Emails @project = @issue.project @updated_by = User.find updated_by_user_id mail(to: recipient(recipient_id), - subject: subject("Changed issue ##{@issue.iid}", @issue.title)) + subject: subject("#{@issue.title} (##{@issue.iid})")) end end end diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index f0b3aab54ed..39c02ca07c9 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -3,27 +3,31 @@ module Emails def new_merge_request_email(recipient_id, merge_request_id) @merge_request = MergeRequest.find(merge_request_id) @project = @merge_request.project - mail(to: recipient(recipient_id), subject: subject("New merge request ##{@merge_request.iid}", @merge_request.title)) + mail(to: recipient(recipient_id), + subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) end def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) @merge_request = MergeRequest.find(merge_request_id) @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id @project = @merge_request.project - mail(to: recipient(recipient_id), subject: subject("Changed merge request ##{@merge_request.iid}", @merge_request.title)) + mail(to: recipient(recipient_id), + subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) end def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id) @merge_request = MergeRequest.find(merge_request_id) @updated_by = User.find updated_by_user_id @project = @merge_request.project - mail(to: recipient(recipient_id), subject: subject("Closed merge request ##{@merge_request.iid}", @merge_request.title)) + mail(to: recipient(recipient_id), + subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) end def merged_merge_request_email(recipient_id, merge_request_id) @merge_request = MergeRequest.find(merge_request_id) @project = @merge_request.project - mail(to: recipient(recipient_id), subject: subject("Accepted merge request ##{@merge_request.iid}", @merge_request.title)) + mail(to: recipient(recipient_id), + subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) end end diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index e967cf6dc73..b727301df5c 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -4,27 +4,31 @@ module Emails @note = Note.find(note_id) @commit = @note.noteable @project = @note.project - mail(to: recipient(recipient_id), subject: subject("Note for commit #{@commit.short_id}", @commit.title)) + mail(to: recipient(recipient_id), + subject: subject("#{@commit.title} (#{@commit.short_id})")) end def note_issue_email(recipient_id, note_id) @note = Note.find(note_id) @issue = @note.noteable @project = @note.project - mail(to: recipient(recipient_id), subject: subject("Note for issue ##{@issue.iid}")) + mail(to: recipient(recipient_id), + subject: subject("#{@issue.title} (##{@issue.iid})")) end def note_merge_request_email(recipient_id, note_id) @note = Note.find(note_id) @merge_request = @note.noteable @project = @note.project - mail(to: recipient(recipient_id), subject: subject("Note for merge request ##{@merge_request.iid}")) + mail(to: recipient(recipient_id), + subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) end def note_wall_email(recipient_id, note_id) @note = Note.find(note_id) @project = @note.project - mail(to: recipient(recipient_id), subject: subject("Note on wall")) + mail(to: recipient(recipient_id), + subject: subject("Note on wall")) end end end |