diff options
author | Robert Speicher <robert@gitlab.com> | 2016-05-02 20:07:28 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-05-02 20:07:28 +0000 |
commit | 2c468ebd2cb9dd6e490fab0ac14dea062e11cacf (patch) | |
tree | c01800db3b988b88bedf3f72311750811ae8c1fb /app | |
parent | 0652d92526cb504be076c059f76360b4c876135b (diff) | |
parent | f64b82e1da47e0f0b4e0f6e91746ed95a98105dd (diff) | |
download | gitlab-ce-2c468ebd2cb9dd6e490fab0ac14dea062e11cacf.tar.gz |
Merge branch 'support-notifications-on-project-snippets' into 'master'
Support e-mail notifications for comments on project snippets
While working with project snippets recently, I noticed that notifications would not be sent out for comments on notes. This MR fixes this.
Note: I'm not completely sure why `ProjectSnippets#participants` returns an empty array if you don't include the concern that is already in `Snippets` but didn't dig into it any more.
Closes #2334
See merge request !3987
Diffstat (limited to 'app')
-rw-r--r-- | app/mailers/emails/notes.rb | 8 | ||||
-rw-r--r-- | app/models/project_snippet.rb | 2 | ||||
-rw-r--r-- | app/views/notify/note_snippet_email.html.haml | 1 | ||||
-rw-r--r-- | app/views/notify/note_snippet_email.text.erb | 8 |
4 files changed, 19 insertions, 0 deletions
diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index cdc40b81ee1..96116e916dd 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -28,6 +28,14 @@ module Emails mail_answer_thread(@merge_request, note_thread_options(recipient_id)) end + def note_snippet_email(recipient_id, note_id) + setup_note_mail(note_id, recipient_id) + + @snippet = @note.noteable + @target_url = namespace_project_snippet_url(*note_target_url_options) + mail_answer_thread(@snippet, note_thread_options(recipient_id)) + end + private def note_target_url_options diff --git a/app/models/project_snippet.rb b/app/models/project_snippet.rb index 1f7d85a5f3d..d48f0546159 100644 --- a/app/models/project_snippet.rb +++ b/app/models/project_snippet.rb @@ -22,4 +22,6 @@ class ProjectSnippet < Snippet # Scopes scope :fresh, -> { order("created_at DESC") } + + participant :author, :notes end diff --git a/app/views/notify/note_snippet_email.html.haml b/app/views/notify/note_snippet_email.html.haml new file mode 100644 index 00000000000..2fa2f784661 --- /dev/null +++ b/app/views/notify/note_snippet_email.html.haml @@ -0,0 +1 @@ += render 'note_message' diff --git a/app/views/notify/note_snippet_email.text.erb b/app/views/notify/note_snippet_email.text.erb new file mode 100644 index 00000000000..4d5a406f4b0 --- /dev/null +++ b/app/views/notify/note_snippet_email.text.erb @@ -0,0 +1,8 @@ +New comment for Snippet <%= @snippet.id %> + +<%= url_for(namespace_project_snippet_url(@snippet.project.namespace, @snippet.project, @snippet, anchor: "note_#{@note.id}")) %> + + +Author: <%= @note.author_name %> + +<%= @note.note %> |