diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 3094e4d3..bfc0fc77 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -126,7 +126,7 @@ class CommentsController < ApplicationController :user_id => commenter.id, :user_type => commenter.class.name) subscriptions.each do |subscription| if (subscription.subscription_type == 'author' and current_user == request_for_comment.user) or subscription.subscription_type == 'all' - UserMailer.got_new_comment_for_subscription(comment, request_for_comment, request_for_comment.user, current_user).deliver_now + UserMailer.got_new_comment_for_subscription(comment, subscription, current_user).deliver_now end end end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 33f6e69c..8022ee84 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -21,12 +21,13 @@ class UserMailer < ActionMailer::Base mail(subject: t('mailers.user_mailer.got_new_comment.subject', commenting_user_displayname: @commenting_user_displayname), to: request_for_comment.user.email) end - def got_new_comment_for_subscription(comment, request_for_comment, from_user, to_user) - @receiver_displayname = to_user.displayname + def got_new_comment_for_subscription(comment, subscription, from_user) + @receiver_displayname = subscription.user.displayname @author_displayname = from_user.displayname @comment_text = comment.text - @rfc_link = request_for_comment_url(request_for_comment) - mail(subject: t('mailers.user_mailer.got_new_comment_for_subscription.subject', author_displayname: @author_displayname), to: to_user.email) + @rfc_link = request_for_comment_url(subscription.request_for_comment) + @unsubscribe_link = unsubscribe_subscription_url(subscription) + mail(subject: t('mailers.user_mailer.got_new_comment_for_subscription.subject', author_displayname: @author_displayname), to: subscription.user.email) end def send_thank_you_note(request_for_comments, receiver) diff --git a/app/views/user_mailer/got_new_comment_for_subscription.html.slim b/app/views/user_mailer/got_new_comment_for_subscription.html.slim index f4d82b4d..b9e1a179 100644 --- a/app/views/user_mailer/got_new_comment_for_subscription.html.slim +++ b/app/views/user_mailer/got_new_comment_for_subscription.html.slim @@ -1 +1,7 @@ -== t('mailers.user_mailer.got_new_comment_for_subscription.body', receiver_displayname: @receiver_displayname, link_to_comment: link_to(@rfc_link, @rfc_link), author_displayname: @author_displayname, comment_text: @comment_text, link_my_comments: link_to(t('request_for_comments.index.get_my_comment_requests'), my_request_for_comments_url), link_all_comments: link_to(t('request_for_comments.index.all'), request_for_comments_url) ) +== t('mailers.user_mailer.got_new_comment_for_subscription.body', + receiver_displayname: @receiver_displayname, link_to_comment: link_to(@rfc_link, @rfc_link), + unsubscribe_link: link_to(@unsubscribe_link, @unsubscribe_link), + author_displayname: @author_displayname, + comment_text: @comment_text, + link_my_comments: link_to(t('request_for_comments.index.get_my_comment_requests'), my_request_for_comments_url), + link_all_comments: link_to(t('request_for_comments.index.all'), request_for_comments_url) ) diff --git a/config/locales/de.yml b/config/locales/de.yml index f0c00da1..d5b8bb87 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -460,12 +460,11 @@ de:
%{author_displayname} schreibt: %{comment_text}

- Sie finden ihre Kommentaranfrage hier: %{link_to_comment}
+ Sie finden die Kommentaranfrage hier: %{link_to_comment}

Falls Sie beim Klick auf diesen Link eine Fehlermeldung erhalten, dass Sie nicht berechtigt wären diese Aktion auszuführen, öffnen Sie bitte eine beliebige Programmieraufgabe aus einem Kurs heraus und klicken den Link danach noch einmal.

- Eine Übersicht Ihrer Kommentaranfragen gibt es hier: %{link_my_comments}
- Alle Kommentaranfragen aller Benutzer finden Sie hier: %{link_all_comments}
+ Wenn Sie keine weiteren Benachrichtigungen zu dieser Anfrage erhalten möchten, klicken Sie bitte hier: %{unsubscribe_link}
Diese Mail wurde automatisch von CodeOcean verschickt.

@@ -477,12 +476,11 @@ de:
%{author_displayname} wrote: %{comment_text}

- You can find your request for comments here: %{link_to_comment}
+ You can find the request for comments here: %{link_to_comment}

If you receive an error that you are not authorized to perform this action when clicking the link, please log-in through any course exercise beforehand and click the link again.

- An overview of all your comments can be accessed here: %{link_my_comments}
- All comments of all participants are available here: %{link_all_comments}
+ If you don't want to be notified about further comments, please click here: %{unsubscribe_link}
This mail was automatically sent by CodeOcean.
subject: "%{author_displayname} hat einen neuen Kommentar in einer Diskussion veröffentlicht, die Sie abonniert haben." diff --git a/config/locales/en.yml b/config/locales/en.yml index 1db04d05..1ad6a9f4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -481,12 +481,11 @@ en:
%{author_displayname} schreibt: %{comment_text}

- Sie finden ihre Kommentaranfrage hier: %{link_to_comment}
+ Sie finden die Kommentaranfrage hier: %{link_to_comment}

Falls Sie beim Klick auf diesen Link eine Fehlermeldung erhalten, dass Sie nicht berechtigt wären diese Aktion auszuführen, öffnen Sie bitte eine beliebige Programmieraufgabe aus einem Kurs heraus und klicken den Link danach noch einmal.

- Eine Übersicht Ihrer Kommentaranfragen gibt es hier: %{link_my_comments}
- Alle Kommentaranfragen aller Benutzer finden Sie hier: %{link_all_comments}
+ Wenn Sie keine weiteren Benachrichtigungen zu dieser Anfrage erhalten möchten, klicken Sie bitte hier: %{unsubscribe_link}
Diese Mail wurde automatisch von CodeOcean verschickt.

@@ -498,12 +497,11 @@ en:
%{author_displayname} wrote: %{comment_text}

- You can find your request for comments here: %{link_to_comment}
+ You can find the request for comments here: %{link_to_comment}

If you receive an error that you are not authorized to perform this action when clicking the link, please log-in through any course exercise beforehand and click the link again.

- An overview of all your comments can be accessed here: %{link_my_comments}
- All comments of all participants are available here: %{link_all_comments}
+ If you don't want to be notified about further comments, please click here: %{unsubscribe_link}
This mail was automatically sent by CodeOcean.
subject: "%{author_displayname} has posted a new comment to a discussion you subscribed to on CodeOcean."