mirror of
https://github.com/mastodon/mastodon.git
synced 2026-09-12 00:46:13 -05:00
Add mailing for new moderation suggestions
This commit is contained in:
@@ -79,6 +79,10 @@ class AdminMailer < ApplicationMailer
|
||||
mail subject: default_i18n_subject(instance: @instance)
|
||||
end
|
||||
|
||||
def new_moderation_suggestions
|
||||
mail subject: default_i18n_subject(instance: @instance)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def process_params
|
||||
|
||||
@@ -55,6 +55,7 @@ class UserSettings
|
||||
setting :appeal, default: true
|
||||
setting :software_updates, default: 'critical', in: %w(none critical patch all)
|
||||
setting :end_of_support, default: true
|
||||
setting :moderation_suggestions, default: true
|
||||
end
|
||||
|
||||
namespace :interactions do
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<%= raw t('admin_mailer.new_moderation_suggestions.body') %>
|
||||
|
||||
<%= raw t('application_mailer.view')%> <%= admin_moderation_suggestions_url %>
|
||||
@@ -23,7 +23,7 @@
|
||||
.fields-group
|
||||
= ff.input :always_send_emails, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_always_send_emails'), hint: I18n.t('simple_form.hints.defaults.setting_always_send_emails')
|
||||
|
||||
- if current_user.can?(:manage_reports, :manage_appeals, :manage_users, :manage_taxonomies)
|
||||
- if current_user.can?(:manage_reports, :manage_appeals, :manage_users, :manage_taxonomies, :manage_federation)
|
||||
%h2= t 'notifications.moderation_emails'
|
||||
|
||||
.fields-group
|
||||
@@ -31,6 +31,7 @@
|
||||
= ff.input :'notification_emails.appeal', as: :boolean, wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.appeal') if current_user.can?(:manage_appeals)
|
||||
= ff.input :'notification_emails.pending_account', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.pending_account') if current_user.can?(:manage_users)
|
||||
= ff.input :'notification_emails.trends', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.trending_tag') if current_user.can?(:manage_taxonomies)
|
||||
= ff.input :'notification_emails.moderation_suggestions', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.moderation_suggestions') if current_user.can?(:manage_federation)
|
||||
|
||||
- if SoftwareUpdate.check_enabled? && current_user.can?(:view_devops)
|
||||
%h2= t 'notifications.administration_emails'
|
||||
|
||||
@@ -10,7 +10,7 @@ class Scheduler::ModerationListSynchronizationScheduler
|
||||
|
||||
ProcessModerationListsService.new.call
|
||||
|
||||
# TODO: mail suggestions
|
||||
mail_suggestions!
|
||||
end
|
||||
|
||||
private
|
||||
@@ -20,4 +20,16 @@ class Scheduler::ModerationListSynchronizationScheduler
|
||||
ModerationSubscriptionSyncService.new.call(subscription)
|
||||
end.any?
|
||||
end
|
||||
|
||||
def mail_suggestions!
|
||||
return unless ModerationSuggestion.exists?(state: :new)
|
||||
|
||||
User.those_who_can(:manage_federation).includes(:account).find_each do |user|
|
||||
next unless user.settings['notification_emails.moderation_suggestions']
|
||||
|
||||
AdminMailer.with(recipient: user.account).new_moderation_suggestions.deliver_later
|
||||
end
|
||||
|
||||
ModerationSuggestion.where(state: :new).in_batches.update_all(state: :mailed)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1425,6 +1425,9 @@ en:
|
||||
new_critical_software_updates:
|
||||
body: New critical versions of Mastodon have been released, you may want to update as soon as possible!
|
||||
subject: Critical Mastodon updates are available for %{instance}!
|
||||
new_moderation_suggestions:
|
||||
body: The moderation lists your server is subscribed to have published new suggestions.
|
||||
subject: New moderation suggestions available on %{instance}!
|
||||
new_pending_account:
|
||||
body: The details of the new account are below. You can approve or reject this application.
|
||||
subject: New account up for review on %{instance} (%{username})
|
||||
|
||||
@@ -350,6 +350,7 @@ en:
|
||||
follow: Someone followed you
|
||||
follow_request: Someone requested to follow you
|
||||
mention: Someone mentioned you
|
||||
moderation_suggestions: Automatic moderation suggestions are available
|
||||
pending_account: New account needs review
|
||||
quote: Someone quoted you
|
||||
reblog: Someone boosted your post
|
||||
|
||||
Reference in New Issue
Block a user