diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-10-28 20:14:25 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-10-28 20:14:25 +0200 |
commit | 26ff48ee48a5c03a2a4b0bd03fd322529e6bd960 (patch) | |
tree | 3e0441d0ace713800cab0dec2fc88a5a86773ddf /app | |
parent | bbdf61c9e46dda1c38388f804ebb3f437d705816 (diff) |
Fix domain block export not exporting blocks with only media rejection
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/export_domain_blocks_controller.rb | 2 | ||||
-rw-r--r-- | app/models/domain_block.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/admin/export_domain_blocks_controller.rb b/app/controllers/admin/export_domain_blocks_controller.rb index db8863551..545bd94ed 100644 --- a/app/controllers/admin/export_domain_blocks_controller.rb +++ b/app/controllers/admin/export_domain_blocks_controller.rb @@ -62,7 +62,7 @@ module Admin def export_data CSV.generate(headers: export_headers, write_headers: true) do |content| - DomainBlock.with_user_facing_limitations.each do |instance| + DomainBlock.with_limitations.each do |instance| content << [instance.domain, instance.severity, instance.reject_media, instance.reject_reports, instance.public_comment, instance.obfuscate] end end diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb index ad1dc2a38..8e298ac9d 100644 --- a/app/models/domain_block.rb +++ b/app/models/domain_block.rb @@ -29,6 +29,7 @@ class DomainBlock < ApplicationRecord scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) } scope :with_user_facing_limitations, -> { where(severity: [:silence, :suspend]) } + scope :with_limitations, -> { where(severity: [:silence, :suspend]).or(where(reject_media: true)) } scope :by_severity, -> { order(Arel.sql('(CASE severity WHEN 0 THEN 1 WHEN 1 THEN 2 WHEN 2 THEN 0 END), domain')) } def to_log_human_identifier |