about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-08-03 15:07:19 -0500
committermultiple creatures <dev@multiple-creature.party>2019-08-03 15:07:19 -0500
commit3e6831d7d6736f296d2e7af4c4fd1fbc3282b381 (patch)
treead14382a55311485e3ff853164d0506a0d85d8bc /app/helpers
parente1bdc82d078db81b04af8da067aa8e9058e096a6 (diff)
include note for admin account actions in audit log
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/log_helper.rb14
-rw-r--r--app/helpers/moderation_helper.rb4
2 files changed, 9 insertions, 9 deletions
diff --git a/app/helpers/log_helper.rb b/app/helpers/log_helper.rb
index d40cb4311..5cb1c4fdc 100644
--- a/app/helpers/log_helper.rb
+++ b/app/helpers/log_helper.rb
@@ -1,5 +1,5 @@
 module LogHelper
-  def user_friendly_action_log(source, action, target)
+  def user_friendly_action_log(source, action, target, reason = nil)
     source = source.username if source.is_a?(Account)
 
     case action
@@ -47,22 +47,22 @@ module LogHelper
       end
 
     when :force_sensitive
-      LogWorker.perform_async("\xf0\x9f\x94\x9e <#{source}> forced the media of <#{target.acct}> to be marked sensitive.")
+      LogWorker.perform_async("\xf0\x9f\x94\x9e <#{source}> forced the media of <#{target.acct}> to be marked sensitive.\n\n#{reason? ? "Comment: #{reason}" : ''}")
     when :force_unlisted
-      LogWorker.perform_async("\xf0\x9f\x94\x89 <#{source}> forced the posts of <#{target.acct}> to be unlisted.")
+      LogWorker.perform_async("\xf0\x9f\x94\x89 <#{source}> forced the posts of <#{target.acct}> to be unlisted.\n\n#{reason? ? "Comment: #{reason}" : ''}")
     when :silence
-      LogWorker.perform_async("\xf0\x9f\x94\x87 <#{source}> silenced <#{target.acct}>'.")
+      LogWorker.perform_async("\xf0\x9f\x94\x87 <#{source}> silenced <#{target.acct}>'.\n\n#{reason? ? "Comment: #{reason}" : ''}")
     when :suspend
-      LogWorker.perform_async("\u26d4 <#{source}> suspended <#{target.acct}>.")
+      LogWorker.perform_async("\u26d4 <#{source}> suspended <#{target.acct}>.\n\n#{reason? ? "Comment: #{reason}" : ''}")
 
     when :allow_nonsensitive
       LogWorker.perform_async("\xf0\x9f\x86\x97 <#{source}> allowed <#{target.acct}> to post media without a sensitive flag.")
     when :allow_public
       LogWorker.perform_async("\xf0\x9f\x86\x8a <#{source}> allowed <#{target.acct}> to post with public visibility.")
     when :unsilence
-      LogWorker.perform_async("\xf0\x9f\x94\x8a <#{source}> unsilenced <#{target.acct}>.")
+      LogWorker.perform_async("\xf0\x9f\x94\x8a <#{source}> unsilenced <#{target.acct}>.\n\n#{reason? ? "Comment: #{reason}" : ''}")
     when :unsuspend
-      LogWorker.perform_async("\xf0\x9f\x86\x97 <#{source}> unsuspended <#{target.acct}>.")
+      LogWorker.perform_async("\xf0\x9f\x86\x97 <#{source}> unsuspended <#{target.acct}>.\n\n#{reason? ? "Comment: #{reason}" : ''}")
 
     when :remove_avatar
       LogWorker.perform_async("\xf0\x9f\x97\x91\xef\xb8\x8f <#{source}> removed the avatar of <#{target.acct}>.")
diff --git a/app/helpers/moderation_helper.rb b/app/helpers/moderation_helper.rb
index 2c45b4b84..10fa05109 100644
--- a/app/helpers/moderation_helper.rb
+++ b/app/helpers/moderation_helper.rb
@@ -17,10 +17,10 @@ module ModerationHelper
 
     if policy == 'reset'
       Admin::ActionLog.create(account: @account, action: unsuspend, target: acct)
-      user_friendly_action_log(@account, :unsuspend, acct)
+      user_friendly_action_log(@account, :unsuspend, acct, reason)
     else
       Admin::ActionLog.create(account: @account, action: policy, target: acct)
-      user_friendly_action_log(@account, policy.to_sym, acct)
+      user_friendly_action_log(@account, policy.to_sym, acct, reason)
     end
 
     case policy