FIX: sends an email notifcation when a user's post is linked

This commit is contained in:
Régis Hanol 2016-02-16 18:29:23 +01:00
parent 3811b8aa4c
commit 63b9d1c645
5 changed files with 33 additions and 1 deletions

View File

@ -26,7 +26,8 @@ class Admin::EmailTemplatesController < Admin::AdminController
"user_notifications.user_invited_to_private_message_pm",
"user_notifications.user_invited_to_topic", "user_notifications.user_mentioned",
"user_notifications.user_posted", "user_notifications.user_posted_pm",
"user_notifications.user_quoted", "user_notifications.user_replied"]
"user_notifications.user_quoted", "user_notifications.user_replied",
"user_notifications.user_linked"]
end
def show

View File

@ -110,6 +110,13 @@ class UserNotifications < ActionMailer::Base
notification_email(user, opts)
end
def user_linked(user, opts)
opts[:allow_reply_by_email] = true
opts[:use_site_subject] = true
opts[:show_category_in_subject] = true
notification_email(user, opts)
end
def user_mentioned(user, opts)
opts[:allow_reply_by_email] = true
opts[:use_site_subject] = true

View File

@ -28,6 +28,10 @@ class UserEmailObserver < ActiveRecord::Observer
enqueue :user_replied
end
def linked
enqueue :user_linked
end
def private_message
enqueue_private(:user_private_message)
end

View File

@ -2095,6 +2095,18 @@ en:
---
%{respond_instructions}
user_linked:
subject_template: "[%{site_name}] %{topic_title}"
text_body_template: |
%{header_instructions}
%{message}
%{context}
---
%{respond_instructions}
user_mentioned:
subject_template: "[%{site_name}] %{topic_title}"
text_body_template: |

View File

@ -99,6 +99,14 @@ describe UserEmailObserver do
include_examples "enqueue_public"
end
context 'user_linked' do
let(:type) { :user_linked }
let(:delay) { SiteSetting.email_time_window_mins.minutes }
let!(:notification) { create_notification(11) }
include_examples "enqueue_public"
end
context 'user_posted' do
let(:type) { :user_posted }
let(:delay) { SiteSetting.email_time_window_mins.minutes }