Add preference to disable e-mails about new pending accounts (#10529)
This commit is contained in:
		
							parent
							
								
									6286ace752
								
							
						
					
					
						commit
						13c1b5bac8
					
				
					 5 changed files with 9 additions and 2 deletions
				
			
		|  | @ -49,7 +49,7 @@ class Settings::PreferencesController < Settings::BaseController | ||||||
|       :setting_hide_network, |       :setting_hide_network, | ||||||
|       :setting_aggregate_reblogs, |       :setting_aggregate_reblogs, | ||||||
|       :setting_show_application, |       :setting_show_application, | ||||||
|       notification_emails: %i(follow follow_request reblog favourite mention digest report), |       notification_emails: %i(follow follow_request reblog favourite mention digest report pending_account), | ||||||
|       interactions: %i(must_be_follower must_be_following) |       interactions: %i(must_be_follower must_be_following) | ||||||
|     ) |     ) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  | @ -191,6 +191,10 @@ class User < ApplicationRecord | ||||||
|     settings.notification_emails['report'] |     settings.notification_emails['report'] | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   def allows_pending_account_emails? | ||||||
|  |     settings.notification_emails['pending_account'] | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|   def hides_network? |   def hides_network? | ||||||
|     @hides_network ||= settings.hide_network |     @hides_network ||= settings.hide_network | ||||||
|   end |   end | ||||||
|  | @ -295,7 +299,7 @@ class User < ApplicationRecord | ||||||
| 
 | 
 | ||||||
|   def notify_staff_about_pending_account! |   def notify_staff_about_pending_account! | ||||||
|     User.staff.includes(:account).each do |u| |     User.staff.includes(:account).each do |u| | ||||||
|       next unless u.allows_report_emails? |       next unless u.allows_pending_account_emails? | ||||||
|       AdminMailer.new_pending_account(u.account, self).deliver_later |       AdminMailer.new_pending_account(u.account, self).deliver_later | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ | ||||||
| 
 | 
 | ||||||
|       - if current_user.staff? |       - if current_user.staff? | ||||||
|         = ff.input :report, as: :boolean, wrapper: :with_label |         = ff.input :report, as: :boolean, wrapper: :with_label | ||||||
|  |         = ff.input :pending_account, as: :boolean, wrapper: :with_label | ||||||
| 
 | 
 | ||||||
|   .fields-group |   .fields-group | ||||||
|     = f.simple_fields_for :notification_emails, hash_to_object(current_user.settings.notification_emails) do |ff| |     = f.simple_fields_for :notification_emails, hash_to_object(current_user.settings.notification_emails) do |ff| | ||||||
|  |  | ||||||
|  | @ -128,6 +128,7 @@ en: | ||||||
|         follow: Send e-mail when someone follows you |         follow: Send e-mail when someone follows you | ||||||
|         follow_request: Send e-mail when someone requests to follow you |         follow_request: Send e-mail when someone requests to follow you | ||||||
|         mention: Send e-mail when someone mentions you |         mention: Send e-mail when someone mentions you | ||||||
|  |         pending_account: Send e-mail when a new account needs review | ||||||
|         reblog: Send e-mail when someone boosts your status |         reblog: Send e-mail when someone boosts your status | ||||||
|         report: Send e-mail when a new report is submitted |         report: Send e-mail when a new report is submitted | ||||||
|     'no': 'No' |     'no': 'No' | ||||||
|  |  | ||||||
|  | @ -39,6 +39,7 @@ defaults: &defaults | ||||||
|     follow_request: true |     follow_request: true | ||||||
|     digest: true |     digest: true | ||||||
|     report: true |     report: true | ||||||
|  |     pending_account: true | ||||||
|   interactions: |   interactions: | ||||||
|     must_be_follower: false |     must_be_follower: false | ||||||
|     must_be_following: false |     must_be_following: false | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue