diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-07-17 15:55:40 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-07-17 15:55:40 -0500 |
commit | 83cb62809ba88b21af6ead3cdda21475178c8245 (patch) | |
tree | 6f3590aa09a5569408fa0273ae2ffd5a751516f0 /app/lib | |
parent | 9f2d158864bb4da2dd72d965c99d368e8f19df16 (diff) |
pretty output for `admin:` bangtags
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/bangtags.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb index a63e908d3..79ce7e7eb 100644 --- a/app/lib/bangtags.rb +++ b/app/lib/bangtags.rb @@ -554,7 +554,7 @@ class Bangtags parts = c.split('@')[1..2] a = Account.find_by(username: parts[0], domain: parts[1]) next if a.nil? - output << " Silenced <code>@#{parts.join('@')}</code>" + output << "<strong>Silenced<strong> <code>@#{parts.join('@')}</code>." Admin::ActionLog.create(account: @account, action: :silence, target: a) a.silence! a.save @@ -570,12 +570,12 @@ class Bangtags domain_block = DomainBlock.find_or_create_by(domain: c) domain_block.severity = "silence" domain_block.save - output << " Silenced <code>#{c}</code>" + output << "<strong>Silenced</strong> <code>#{c}</code>." Admin::ActionLog.create(account: @account, action: :create, target: domain_block) BlockDomainService.new.call(domain_block) end end - output = [' No action.'] if output.blank? + output = ['<em>No action.</em>'] if output.blank? chunk = output.join("\n") + "\n" when 'forgive', 'unsilence', 'unsuspend' chunk.split.each do |c| @@ -583,7 +583,7 @@ class Bangtags parts = c.split('@')[1..2] a = Account.find_by(username: parts[0], domain: parts[1]) next if a.nil? - output << " Reset policy for <code>@#{parts.join('@')}</code>" + output << "<strong>Reset policy</strong> for <code>@#{parts.join('@')}</code>." Admin::ActionLog.create(account: @account, action: :unsilence, target: a) a.unsilence! Admin::ActionLog.create(account: @account, action: :unsuspend, target: a) @@ -594,12 +594,12 @@ class Bangtags next if c.end_with?('monsterpit.net', 'tailma.ws') domain_block = DomainBlock.find_by(domain: c) next if domain_block.nil? - output << " Reset policy for <code>#{c}<code>" + output << "<strong>Reset policy</strong> for <code>#{c}<code>." Admin::ActionLog.create(account: @account, action: :destroy, target: domain_block) UnblockDomainService.new.call(domain_block) end end - output = [' No action.'] if output.blank? + output = ['<em>No action.</em>'] if output.blank? chunk = output.join("\n") + "\n" when 'suspend' chunk.split.each do |c| @@ -607,7 +607,7 @@ class Bangtags parts = c.split('@')[1..2] a = Account.find_by(username: parts[0], domain: parts[1]) next if a.nil? - output << " Suspended <code>@#{parts.join('@')}</code>" + output << "<strong>Suspended</strong> <code>@#{parts.join('@')}</code>." Admin::ActionLog.create(account: @account, action: :suspend, target: a) SuspendAccountService.new.call(a, include_user: true) elsif c.match?(/\A[\w\-]+\.[\w\-]+(?:\.[\w\-]+)*\Z/) @@ -623,12 +623,12 @@ class Bangtags domain_block.severity = "suspend" domain_block.reject_media = true domain_block.save - output << " Suspended <code>#{c}</code>" + output << "<strong>Suspended</strong> <code>#{c}</code>." Admin::ActionLog.create(account: @account, action: :create, target: domain_block) BlockDomainService.new.call(domain_block) end end - output = [' No action.'] if output.blank? + output = ['<em>No action.</em>'] if output.blank? chunk = output.join("\n") + "\n" end end |