Fix saved searces, news updates, ip bans being dumped to BigQuery.
Prevent saved searches, news updates, and ip bans from being publicly dumped to BigQuery. They didn't override the `visible` method to restrict their visibility for anonymous users.
This commit is contained in:
@@ -2,4 +2,18 @@ class NewsUpdate < ApplicationRecord
|
||||
belongs_to :creator, class_name: "User"
|
||||
belongs_to_updater
|
||||
scope :recent, -> {where("created_at >= ?", 2.weeks.ago).order("created_at desc").limit(5)}
|
||||
|
||||
def self.visible(user)
|
||||
if user.is_admin?
|
||||
all
|
||||
else
|
||||
none
|
||||
end
|
||||
end
|
||||
|
||||
def self.search(params)
|
||||
q = search_attributes(params, :id, :created_at, :updated_at, :message, :creator, :updater)
|
||||
q = q.apply_default_order(params)
|
||||
q
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user