Add unsubscribe link to emails and cleanup user mailer
This commit is contained in:
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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) )
|
||||
|
Reference in New Issue
Block a user