about summary refs log tree commit diff
path: root/app/workers/log_worker.rb
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-07-26 13:25:24 -0500
committermultiple creatures <dev@multiple-creature.party>2019-07-26 15:20:57 -0500
commit0151f14dbc1abf33e6bf5cf9bbd2e8038fa39740 (patch)
tree0362a9226de6aaf0da65289433ca69192159557a /app/workers/log_worker.rb
parente0b257d512708c8c4fc14af538501954070e0056 (diff)
split federation & moderation logs into different subscopes + make scope tag prefix configurable
Diffstat (limited to 'app/workers/log_worker.rb')
-rw-r--r--app/workers/log_worker.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/workers/log_worker.rb b/app/workers/log_worker.rb
index abeadefa6..d3d22c88e 100644
--- a/app/workers/log_worker.rb
+++ b/app/workers/log_worker.rb
@@ -5,18 +5,21 @@ class LogWorker
 
   sidekiq_options unique: :until_executed
 
-  def perform(log_text)
+  def perform(log_text, scope = nil)
     logger_id = ENV['LOG_USER'].to_i
     return true if logger_id == 0
 
     logger = Account.find_by(id: logger_id)
     return true if logger.nil?
 
+    scope_prefix = ENV.fetch('LOG_SCOPE_PREFIX', 'admin.log')
+    tag = scope.nil? ? scope_prefix : "#{scope_prefix}.#{scope}"
+
     PostStatusService.new.call(
       logger,
       created_at: Time.now.utc,
       text: log_text.strip,
-      tags: ['monsterpit.admin.log'],
+      tags: [tag],
       visibility: :unlisted,
       local_only: true,
       content_type: 'text/plain',