mirror of
https://github.com/mastodon/mastodon.git
synced 2025-11-29 19:03:41 +00:00
Split “Notify the user per e-mail” into two toggles
This commit is contained in:
parent
d3b637c757
commit
b618241ce8
|
|
@ -19,6 +19,7 @@ class Admin::Reports::ActionsController < Admin::BaseController
|
||||||
current_account: current_account,
|
current_account: current_account,
|
||||||
report_id: @report.id,
|
report_id: @report.id,
|
||||||
send_email_notification: !@report.spam?,
|
send_email_notification: !@report.spam?,
|
||||||
|
send_in_app_notification: !@report.spam?,
|
||||||
text: params[:text]
|
text: params[:text]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -30,6 +31,7 @@ class Admin::Reports::ActionsController < Admin::BaseController
|
||||||
target_account: @report.target_account,
|
target_account: @report.target_account,
|
||||||
current_account: current_account,
|
current_account: current_account,
|
||||||
send_email_notification: !@report.spam?,
|
send_email_notification: !@report.spam?,
|
||||||
|
send_in_app_notification: !@report.spam?,
|
||||||
text: params[:text]
|
text: params[:text]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ class Api::V1::Admin::AccountActionsController < Api::BaseController
|
||||||
:report_id,
|
:report_id,
|
||||||
:warning_preset_id,
|
:warning_preset_id,
|
||||||
:text,
|
:text,
|
||||||
:send_email_notification
|
:send_email_notification,
|
||||||
|
:send_in_app_notification
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,10 @@ class Admin::AccountAction
|
||||||
:report_id,
|
:report_id,
|
||||||
:warning_preset_id
|
:warning_preset_id
|
||||||
|
|
||||||
attr_reader :warning, :send_email_notification, :include_statuses
|
attr_reader :warning, :send_email_notification, :send_in_app_notification, :include_statuses
|
||||||
|
|
||||||
alias send_email_notification? send_email_notification
|
alias send_email_notification? send_email_notification
|
||||||
|
alias send_in_app_notification? send_in_app_notification
|
||||||
alias include_statuses? include_statuses
|
alias include_statuses? include_statuses
|
||||||
|
|
||||||
validates :type, :target_account, :current_account, presence: true
|
validates :type, :target_account, :current_account, presence: true
|
||||||
|
|
@ -30,6 +31,7 @@ class Admin::AccountAction
|
||||||
|
|
||||||
def initialize(attributes = {})
|
def initialize(attributes = {})
|
||||||
@send_email_notification = true
|
@send_email_notification = true
|
||||||
|
@send_in_app_notification = true
|
||||||
@include_statuses = true
|
@include_statuses = true
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
@ -39,6 +41,10 @@ class Admin::AccountAction
|
||||||
@send_email_notification = ActiveModel::Type::Boolean.new.cast(value)
|
@send_email_notification = ActiveModel::Type::Boolean.new.cast(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_in_app_notification=(value)
|
||||||
|
@send_in_app_notification = ActiveModel::Type::Boolean.new.cast(value)
|
||||||
|
end
|
||||||
|
|
||||||
def include_statuses=(value)
|
def include_statuses=(value)
|
||||||
@include_statuses = ActiveModel::Type::Boolean.new.cast(value)
|
@include_statuses = ActiveModel::Type::Boolean.new.cast(value)
|
||||||
end
|
end
|
||||||
|
|
@ -167,14 +173,10 @@ class Admin::AccountAction
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_notification!
|
def process_notification!
|
||||||
return unless warnable?
|
return unless target_account.local?
|
||||||
|
|
||||||
UserMailer.warning(target_account.user, warning).deliver_later!
|
UserMailer.warning(target_account.user, warning).deliver_later! if send_email_notification?
|
||||||
LocalNotificationWorker.perform_async(target_account.id, warning.id, 'AccountWarning', 'moderation_warning')
|
LocalNotificationWorker.perform_async(target_account.id, warning.id, 'AccountWarning', 'moderation_warning') if send_in_app_notification?
|
||||||
end
|
|
||||||
|
|
||||||
def warnable?
|
|
||||||
send_email_notification? && target_account.local?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_ids
|
def status_ids
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,16 @@ class Admin::StatusBatchAction
|
||||||
:status_ids, :report_id,
|
:status_ids, :report_id,
|
||||||
:text
|
:text
|
||||||
|
|
||||||
attr_reader :send_email_notification
|
attr_reader :send_email_notification, :send_in_app_notification
|
||||||
|
|
||||||
def send_email_notification=(value)
|
def send_email_notification=(value)
|
||||||
@send_email_notification = ActiveModel::Type::Boolean.new.cast(value)
|
@send_email_notification = ActiveModel::Type::Boolean.new.cast(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_in_app_notification=(value)
|
||||||
|
@send_in_app_notification = ActiveModel::Type::Boolean.new.cast(value)
|
||||||
|
end
|
||||||
|
|
||||||
def save!
|
def save!
|
||||||
process_action!
|
process_action!
|
||||||
end
|
end
|
||||||
|
|
@ -129,14 +133,10 @@ class Admin::StatusBatchAction
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_notification!
|
def process_notification!
|
||||||
return unless warnable?
|
return unless target_account.local?
|
||||||
|
|
||||||
UserMailer.warning(target_account.user, @warning).deliver_later!
|
UserMailer.warning(target_account.user, @warning).deliver_later! if send_email_notification
|
||||||
LocalNotificationWorker.perform_async(target_account.id, @warning.id, 'AccountWarning', 'moderation_warning')
|
LocalNotificationWorker.perform_async(target_account.id, @warning.id, 'AccountWarning', 'moderation_warning') if send_in_app_notification
|
||||||
end
|
|
||||||
|
|
||||||
def warnable?
|
|
||||||
send_email_notification && target_account.local?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def target_account
|
def target_account
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@
|
||||||
as: :boolean,
|
as: :boolean,
|
||||||
wrapper: :with_label
|
wrapper: :with_label
|
||||||
|
|
||||||
|
= f.input :send_in_app_notification,
|
||||||
|
as: :boolean,
|
||||||
|
wrapper: :with_label
|
||||||
|
|
||||||
- if params[:report_id].present?
|
- if params[:report_id].present?
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :include_statuses,
|
= f.input :include_statuses,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ en:
|
||||||
title: Optional. Not visible to the recipient
|
title: Optional. Not visible to the recipient
|
||||||
admin_account_action:
|
admin_account_action:
|
||||||
include_statuses: The user will see which posts have caused the moderation action or warning
|
include_statuses: The user will see which posts have caused the moderation action or warning
|
||||||
send_email_notification: The user will receive an explanation of what happened with their account
|
send_email_notification: The user will receive an email with an explanation of what happened with their account
|
||||||
|
send_in_app_notification: The user will receive an in-app notification with an explanation of what happened with their account
|
||||||
text_html: Optional. You can use post syntax. You can <a href="%{path}">add warning presets</a> to save time
|
text_html: Optional. You can use post syntax. You can <a href="%{path}">add warning presets</a> to save time
|
||||||
type_html: Choose what to do with <strong>%{acct}</strong>
|
type_html: Choose what to do with <strong>%{acct}</strong>
|
||||||
types:
|
types:
|
||||||
|
|
@ -174,6 +175,7 @@ en:
|
||||||
admin_account_action:
|
admin_account_action:
|
||||||
include_statuses: Include reported posts in the e-mail
|
include_statuses: Include reported posts in the e-mail
|
||||||
send_email_notification: Notify the user per e-mail
|
send_email_notification: Notify the user per e-mail
|
||||||
|
send_in_app_notification: Notify the user in the application
|
||||||
text: Custom warning
|
text: Custom warning
|
||||||
type: Action
|
type: Action
|
||||||
types:
|
types:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user