From 8e20e16cf030fef48850df4764bbf13a317f6b0c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 8 Apr 2022 18:03:31 +0200 Subject: Change e-mail notifications to only be sent when recipient is offline (#17984) * Change e-mail notifications to only be sent when recipient is offline Change the default for follow and mention notifications back on * Add preference to always send e-mail notifications * Change wording --- app/lib/user_settings_decorator.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/lib') diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb index de054e403ee..5fb7655a9b4 100644 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@ -38,6 +38,7 @@ class UserSettingsDecorator user.settings['use_pending_items'] = use_pending_items_preference if change?('setting_use_pending_items') user.settings['trends'] = trends_preference if change?('setting_trends') user.settings['crop_images'] = crop_images_preference if change?('setting_crop_images') + user.settings['always_send_emails'] = always_send_emails_preference if change?('setting_always_send_emails') end def merged_notification_emails @@ -132,6 +133,10 @@ class UserSettingsDecorator boolean_cast_setting 'setting_crop_images' end + def always_send_emails_preference + boolean_cast_setting 'setting_always_send_emails' + end + def boolean_cast_setting(key) ActiveModel::Type::Boolean.new.cast(settings[key]) end -- cgit v1.2.3