mirror of
https://github.com/discourse/discourse.git
synced 2025-01-20 19:21:45 +08:00
FIX: sends an email notifcation when a user's post is linked
This commit is contained in:
parent
3811b8aa4c
commit
63b9d1c645
|
@ -26,7 +26,8 @@ class Admin::EmailTemplatesController < Admin::AdminController
|
||||||
"user_notifications.user_invited_to_private_message_pm",
|
"user_notifications.user_invited_to_private_message_pm",
|
||||||
"user_notifications.user_invited_to_topic", "user_notifications.user_mentioned",
|
"user_notifications.user_invited_to_topic", "user_notifications.user_mentioned",
|
||||||
"user_notifications.user_posted", "user_notifications.user_posted_pm",
|
"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
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -110,6 +110,13 @@ class UserNotifications < ActionMailer::Base
|
||||||
notification_email(user, opts)
|
notification_email(user, opts)
|
||||||
end
|
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)
|
def user_mentioned(user, opts)
|
||||||
opts[:allow_reply_by_email] = true
|
opts[:allow_reply_by_email] = true
|
||||||
opts[:use_site_subject] = true
|
opts[:use_site_subject] = true
|
||||||
|
|
|
@ -28,6 +28,10 @@ class UserEmailObserver < ActiveRecord::Observer
|
||||||
enqueue :user_replied
|
enqueue :user_replied
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def linked
|
||||||
|
enqueue :user_linked
|
||||||
|
end
|
||||||
|
|
||||||
def private_message
|
def private_message
|
||||||
enqueue_private(:user_private_message)
|
enqueue_private(:user_private_message)
|
||||||
end
|
end
|
||||||
|
|
|
@ -2095,6 +2095,18 @@ en:
|
||||||
---
|
---
|
||||||
%{respond_instructions}
|
%{respond_instructions}
|
||||||
|
|
||||||
|
user_linked:
|
||||||
|
subject_template: "[%{site_name}] %{topic_title}"
|
||||||
|
text_body_template: |
|
||||||
|
%{header_instructions}
|
||||||
|
|
||||||
|
%{message}
|
||||||
|
|
||||||
|
%{context}
|
||||||
|
|
||||||
|
---
|
||||||
|
%{respond_instructions}
|
||||||
|
|
||||||
user_mentioned:
|
user_mentioned:
|
||||||
subject_template: "[%{site_name}] %{topic_title}"
|
subject_template: "[%{site_name}] %{topic_title}"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
|
|
@ -99,6 +99,14 @@ describe UserEmailObserver do
|
||||||
include_examples "enqueue_public"
|
include_examples "enqueue_public"
|
||||||
end
|
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
|
context 'user_posted' do
|
||||||
let(:type) { :user_posted }
|
let(:type) { :user_posted }
|
||||||
let(:delay) { SiteSetting.email_time_window_mins.minutes }
|
let(:delay) { SiteSetting.email_time_window_mins.minutes }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user