A platform for community discussion. Free, open, simple.
FIX: Add missing email template for `user_watching_category_or_tag` (#19653)
Gerhard Schlager7e33cb36656c
diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex 112db663c97..de5ff4e9c03 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -3791,6 +3791,18 @@ en:%{respond_instructions}+ user_watching_category_or_tag:+ title: "User Watching Category or Tag"+ subject_template: "[%{email_prefix}] %{topic_title}"+ text_body_template: |+ %{header_instructions}++ %{message}++ %{context}++ %{respond_instructions}+user_watching_first_post:title: "User Watching First Post"subject_template: "[%{email_prefix}] %{topic_title}"diff --git a/spec/services/notification_emailer_spec.rb b/spec/services/notification_emailer_spec.rbindex f0a87ebf332..af15c4f19f9 100644--- a/spec/services/notification_emailer_spec.rb+++ b/spec/services/notification_emailer_spec.rb@@ -197,6 +197,15 @@ RSpec.describe NotificationEmailer doinclude_examples "enqueue_public"end+ context 'with user_watching_category_or_tag' do+ let(:no_delay) { no_delay }+ let(:type) { :user_posted }+ let(:delay) { SiteSetting.email_time_window_mins.minutes }+ let!(:notification) { create_notification(:watching_category_or_tag) }++ include_examples "enqueue_public"+ end+context 'with user_private_message' dolet(:no_delay) { no_delay }let(:type) { :user_private_message }@@ -251,4 +260,34 @@ RSpec.describe NotificationEmailer doinclude_examples "enqueue_public"endend++ it "has translations for each sendable notification type" do+ notification = create_notification(:mentioned)+ email_user = NotificationEmailer::EmailUser.new(notification, no_delay: true)+ subkeys = ["title", "subject_template", "text_body_template"]++ # some notification types need special handling+ replace_keys = {+ "post_approved" => ["post_approved"],+ "private_message" => ["user_posted"],+ "invited_to_private_message" => [+ "user_invited_to_private_message_pm",+ "user_invited_to_private_message_pm_group",+ "user_invited_to_private_message_pm_staged"+ ]+ }++ Notification.types.keys.each do |notification_type|+ if email_user.respond_to?(notification_type)+ type_keys = replace_keys[notification_type.to_s] || ["user_#{notification_type}"]++ type_keys.each do |type_key|+ subkeys.each do |subkey|+ key = "user_notifications.#{type_key}.#{subkey}"+ expect(I18n.exists?(key)).to eq(true), "missing translation: #{key}"+ end+ end+ end+ end+ endend