]> cat aescling's git repositories - mastodon.git/commitdiff
Add preference to disable e-mails about new pending accounts (#10529)
authorEugen Rochko <eugen@zeonfederated.com>
Tue, 9 Apr 2019 22:35:49 +0000 (00:35 +0200)
committerGitHub <noreply@github.com>
Tue, 9 Apr 2019 22:35:49 +0000 (00:35 +0200)
app/controllers/settings/preferences_controller.rb
app/models/user.rb
app/views/settings/notifications/show.html.haml
config/locales/simple_form.en.yml
config/settings.yml

index 90967635da59632f7be027b6db20bd5856714578..5afdf0eec0d34609f248e2a338e13325ec341584 100644 (file)
@@ -49,7 +49,7 @@ class Settings::PreferencesController < Settings::BaseController
       :setting_hide_network,
       :setting_aggregate_reblogs,
       :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)
     )
   end
index c9309bc2167d79e611006f8f59b0b45a260299cd..135baae122b42ef4952dc994a0a199087b4dab51 100644 (file)
@@ -191,6 +191,10 @@ class User < ApplicationRecord
     settings.notification_emails['report']
   end
 
+  def allows_pending_account_emails?
+    settings.notification_emails['pending_account']
+  end
+
   def hides_network?
     @hides_network ||= settings.hide_network
   end
@@ -295,7 +299,7 @@ class User < ApplicationRecord
 
   def notify_staff_about_pending_account!
     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
     end
   end
index 8aaac043b711d013dfe2231c94fbda6718234542..6ec57b502f7dbc228f5a7d5e0b8c3b3534f98fa0 100644 (file)
@@ -14,6 +14,7 @@
 
       - if current_user.staff?
         = ff.input :report, as: :boolean, wrapper: :with_label
+        = ff.input :pending_account, as: :boolean, wrapper: :with_label
 
   .fields-group
     = f.simple_fields_for :notification_emails, hash_to_object(current_user.settings.notification_emails) do |ff|
index 3317127f3ceddfd896b3abc47e870f51e79b195c..1a43e19e2314bfec321dc6c2929c690e1dfb0107 100644 (file)
@@ -128,6 +128,7 @@ en:
         follow: Send e-mail when someone follows you
         follow_request: Send e-mail when someone requests to follow 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
         report: Send e-mail when a new report is submitted
     'no': 'No'
index 4f05519a555e49a5ca89b233466c0f1a9346d1fe..63f7c338038143842dec4d29dd27a13b7015d0f9 100644 (file)
@@ -39,6 +39,7 @@ defaults: &defaults
     follow_request: true
     digest: true
     report: true
+    pending_account: true
   interactions:
     must_be_follower: false
     must_be_following: false