artists: redact version histories of banned artists.
Fix names and urls of banned artists being visible in Google through artist version pages.
This commit is contained in:
@@ -29,6 +29,14 @@ class ApplicationRecord < ActiveRecord::Base
|
||||
def visible(user)
|
||||
all
|
||||
end
|
||||
|
||||
def policy(current_user)
|
||||
Pundit.policy(current_user, self)
|
||||
end
|
||||
end
|
||||
|
||||
def policy(current_user)
|
||||
Pundit.policy(current_user, self)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -5,6 +5,14 @@ class ArtistVersion < ApplicationRecord
|
||||
belongs_to_updater
|
||||
belongs_to :artist
|
||||
|
||||
def self.visible(user)
|
||||
if policy(user).can_view_banned?
|
||||
all
|
||||
else
|
||||
where(artist: Artist.unbanned)
|
||||
end
|
||||
end
|
||||
|
||||
module SearchMethods
|
||||
def search(params)
|
||||
q = search_attributes(params, :id, :created_at, :updated_at, :is_deleted, :is_banned, :name, :group_name, :urls, :other_names, :updater, :artist)
|
||||
|
||||
Reference in New Issue
Block a user