alaveteli icon indicating copy to clipboard operation
alaveteli copied to clipboard

Disable "similar requests"-sidebar on problematic requests

Open WilliamWDTK opened this issue 2 years ago • 1 comments

Disable "similar requests"-sidebar on problematic requests, including for the requester where they are requester_only.

Reduced prominence requests are problematic, not sure apart from that.

Could also hide on requests to certain bodies or some other measure of determining likelihood of problematicness.

WilliamWDTK avatar Sep 25 '22 19:09 WilliamWDTK

some other measure of determining likelihood of problematicness

Could do this via tags.

class InfoRequest
  cattr_accessor :problematic_tags, default: []

  def show_similar_requests?
    true unless reduced_prominence? || problematic_tags?
  end

  def reduced_prominence?
    prominence != 'normal'
  end

  def problematic_tags?
    tags.any? { |tag| self.class.problematic_tags.include?(tag) }
  end
end

# In theme
InfoRequest.problematic_tags = ['foo', 'bar', 'baz']

garethrees avatar Sep 26 '22 08:09 garethrees