about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/admin/status_batch_action.rb12
-rw-r--r--app/models/trends/tags.rb7
2 files changed, 13 insertions, 6 deletions
diff --git a/app/models/admin/status_batch_action.rb b/app/models/admin/status_batch_action.rb
index 85822214b..40f60f379 100644
--- a/app/models/admin/status_batch_action.rb
+++ b/app/models/admin/status_batch_action.rb
@@ -8,6 +8,12 @@ class Admin::StatusBatchAction
   attr_accessor :current_account, :type,
                 :status_ids, :report_id
 
+  attr_reader :send_email_notification
+
+  def send_email_notification=(value)
+    @send_email_notification = ActiveModel::Type::Boolean.new.cast(value)
+  end
+
   def save!
     process_action!
   end
@@ -55,7 +61,7 @@ class Admin::StatusBatchAction
       statuses.each { |status| Tombstone.find_or_create_by(uri: status.uri, account: status.account, by_moderator: true) } unless target_account.local?
     end
 
-    UserMailer.warning(target_account.user, @warning).deliver_later! if target_account.local?
+    UserMailer.warning(target_account.user, @warning).deliver_later! if warnable?
     RemovalWorker.push_bulk(status_ids) { |status_id| [status_id, { 'preserve' => target_account.local?, 'immediate' => !target_account.local? }] }
   end
 
@@ -82,6 +88,10 @@ class Admin::StatusBatchAction
     !report.nil?
   end
 
+  def warnable?
+    send_email_notification && target_account.local?
+  end
+
   def target_account
     @target_account ||= statuses.first.account
   end
diff --git a/app/models/trends/tags.rb b/app/models/trends/tags.rb
index a425fd207..2ea4550df 100644
--- a/app/models/trends/tags.rb
+++ b/app/models/trends/tags.rb
@@ -11,12 +11,9 @@ class Trends::Tags < Trends::Base
   }
 
   def register(status, at_time = Time.now.utc)
-    original_status = status.reblog? ? status.reblog : status
+    return unless !status.reblog? && status.public_visibility? && !status.account.silenced?
 
-    return unless original_status.public_visibility? && status.public_visibility? &&
-                  !original_status.account.silenced? && !status.account.silenced?
-
-    original_status.tags.each do |tag|
+    status.tags.each do |tag|
       add(tag, status.account_id, at_time) if tag.usable?
     end
   end