diff --git a/app/controllers/admin/email_templates_controller.rb b/app/controllers/admin/email_templates_controller.rb index 9d872c99842..ccbb3eaf692 100644 --- a/app/controllers/admin/email_templates_controller.rb +++ b/app/controllers/admin/email_templates_controller.rb @@ -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 diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index 51729427816..2f4423cb146 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -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 diff --git a/app/models/user_email_observer.rb b/app/models/user_email_observer.rb index db9dbdc73ef..31128235ef9 100644 --- a/app/models/user_email_observer.rb +++ b/app/models/user_email_observer.rb @@ -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 diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 2e7ef476879..281d5365467 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -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: | diff --git a/spec/models/user_email_observer_spec.rb b/spec/models/user_email_observer_spec.rb index 0f1150c4dd1..c0b8da164ed 100644 --- a/spec/models/user_email_observer_spec.rb +++ b/spec/models/user_email_observer_spec.rb @@ -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 }