FEATURE: add site preference for standard subjects, including support for Re

This commit is contained in:
Arpit Jalan
2014-09-29 10:46:55 +05:30
parent 5d91a4ef0c
commit 330b7ba54a
5 changed files with 79 additions and 3 deletions

View File

@@ -83,26 +83,33 @@ class UserNotifications < ActionMailer::Base
def user_replied(user, opts)
opts[:allow_reply_by_email] = true
opts[:use_site_subject] = true
notification_email(user, opts)
end
def user_quoted(user, opts)
opts[:allow_reply_by_email] = true
opts[:use_site_subject] = true
notification_email(user, opts)
end
def user_mentioned(user, opts)
opts[:allow_reply_by_email] = true
opts[:use_site_subject] = true
notification_email(user, opts)
end
def user_posted(user, opts)
opts[:allow_reply_by_email] = true
opts[:use_site_subject] = true
opts[:add_re_to_subject] = true
notification_email(user, opts)
end
def user_private_message(user, opts)
opts[:allow_reply_by_email] = true
opts[:use_site_subject] = true
opts[:add_re_to_subject] = true
# We use the 'user_posted' event when you are emailed a post in a PM.
opts[:notification_type] = 'posted'
@@ -116,6 +123,8 @@ class UserNotifications < ActionMailer::Base
post: post,
from_alias: post.user.username,
allow_reply_by_email: true,
use_site_subject: true,
add_re_to_subject: true,
notification_type: "posted",
user: user
)
@@ -163,12 +172,16 @@ class UserNotifications < ActionMailer::Base
title = @notification.data_hash[:topic_title]
allow_reply_by_email = opts[:allow_reply_by_email] unless user.suspended?
use_site_subject = opts[:use_site_subject]
add_re_to_subject = opts[:add_re_to_subject]
send_notification_email(
title: title,
post: @post,
from_alias: username,
allow_reply_by_email: allow_reply_by_email,
use_site_subject: use_site_subject,
add_re_to_subject: add_re_to_subject,
notification_type: notification_type,
user: user
)
@@ -179,6 +192,8 @@ class UserNotifications < ActionMailer::Base
post = opts[:post]
title = opts[:title]
allow_reply_by_email = opts[:allow_reply_by_email]
use_site_subject = opts[:use_site_subject]
add_re_to_subject = opts[:add_re_to_subject] && post.post_number > 1
from_alias = opts[:from_alias]
notification_type = opts[:notification_type]
user = opts[:user]
@@ -224,6 +239,8 @@ class UserNotifications < ActionMailer::Base
username: from_alias,
add_unsubscribe_link: true,
allow_reply_by_email: allow_reply_by_email,
use_site_subject: use_site_subject,
add_re_to_subject: add_re_to_subject,
private_reply: post.topic.private_message?,
include_respond_instructions: !user.suspended?,
template: template,