Allow all users to view and edit artist entries and wiki pages belonging to banned artists. There was little need to hide these pages from Members, it was mainly to appease artists who didn't like us even linking to their sites. These restrictions also had multiple flaws: * Banned artist information was still visible in the API. * It was still possible to edit banned artists using the API. * It was still possible for unprivileged users to revert banned artist entries or wiki pages to previous versions. * The restrictions were inconsistent: in various places they were either Member-only, Gold-only, or Builder-only.
31 lines
695 B
Ruby
31 lines
695 B
Ruby
class ArtistVersion < ApplicationRecord
|
|
array_attribute :urls
|
|
array_attribute :other_names
|
|
|
|
belongs_to_updater
|
|
belongs_to :artist
|
|
|
|
module SearchMethods
|
|
def search(params)
|
|
q = super
|
|
|
|
q = q.search_attributes(params, :updater, :is_active, :is_banned, :artist_id, :name, :group_name)
|
|
|
|
params[:order] ||= params.delete(:sort)
|
|
if params[:order] == "name"
|
|
q = q.order("artist_versions.name").default_order
|
|
else
|
|
q = q.apply_default_order(params)
|
|
end
|
|
|
|
q
|
|
end
|
|
end
|
|
|
|
extend SearchMethods
|
|
|
|
def previous
|
|
ArtistVersion.where("artist_id = ? and created_at < ?", artist_id, created_at).order("created_at desc").first
|
|
end
|
|
end
|