diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-07-17 01:14:08 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-07-17 01:14:08 -0500 |
commit | 38a3c2b7b9b2d11ffb586acd051ed755b9377cea (patch) | |
tree | d777a3f108c5b9b1c7ef933e0eeb8663ee3014ec /app | |
parent | 92406964f1c9c2c5b7c3dfab5c7d9179cbb3804f (diff) |
add `admin:unsuspend` bangtag & aliases
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/bangtags.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb index d6b219c2a..635820789 100644 --- a/app/lib/bangtags.rb +++ b/app/lib/bangtags.rb @@ -495,7 +495,7 @@ class Bangtags next unless @account.user.admin? next if cmd[1].nil? case cmd[1].downcase - when 'silence', 'suspend' + when 'silence', 'unsilence', 'suspend', 'unsuspend', 'forgive' chunk = "`admin:#{cmd[1].downcase}`:\n" @tf_cmds.push(cmd) @component_stack.push(:tf) @@ -549,6 +549,30 @@ class Bangtags end output = [' No action.'] if output.blank? chunk = output.join("\n") + "\n" + when 'forgive', 'unsilence', 'unsuspend' + chunk.split.each do |c| + if c.start_with?('@') + parts = c.split('@')[1..2] + a = Account.find_by(username: parts[0], domain: parts[1]) + next if a.nil? + output << " Reset policy for `@#{parts.join('@')}`" + Admin::ActionLog.create(account: @account, action: :unsilence, target: a) + a.unsilence! + Admin::ActionLog.create(account: @account, action: :unsuspend, target: a) + a.unsuspend! + a.save + elsif c.match?(/^[\w\-]+\.[\w\-]+(?:\.[\w\-]+)*$/) + c.downcase! + 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 `#{c}`" + Admin::ActionLog.create(account: @account, action: :destroy, target: domain_block) + UnblockDomainService.new.call(domain_block) + end + end + output = [' No action.'] if output.blank? + chunk = output.join("\n") + "\n" when 'suspend' chunk.split.each do |c| if c.start_with?('@') |