Fix #4275: Unable to update "banned artist" entries.
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.
This commit is contained in:
@@ -26,7 +26,7 @@ module PostSets
|
||||
|
||||
def wiki_page
|
||||
return nil unless tag.present? && tag.wiki_page.present?
|
||||
return nil unless !tag.wiki_page.is_deleted? && tag.wiki_page.visible?
|
||||
return nil unless !tag.wiki_page.is_deleted?
|
||||
tag.wiki_page
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ module PostSets
|
||||
|
||||
def artist
|
||||
return nil unless tag.present? && tag.category == Tag.categories.artist
|
||||
return nil unless tag.artist.present? && tag.artist.is_active? && tag.artist.visible?
|
||||
return nil unless tag.artist.present? && tag.artist.is_active?
|
||||
tag.artist
|
||||
end
|
||||
|
||||
|
||||
@@ -538,8 +538,4 @@ class Artist < ApplicationRecord
|
||||
"Deleted"
|
||||
end
|
||||
end
|
||||
|
||||
def visible?
|
||||
!is_banned? || CurrentUser.is_gold?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,6 @@ class ArtistVersion < ApplicationRecord
|
||||
|
||||
belongs_to_updater
|
||||
belongs_to :artist
|
||||
delegate :visible?, :to => :artist
|
||||
|
||||
module SearchMethods
|
||||
def search(params)
|
||||
|
||||
@@ -244,10 +244,6 @@ class WikiPage < ApplicationRecord
|
||||
TagAlias.to_aliased(titles & tags)
|
||||
end
|
||||
|
||||
def visible?
|
||||
artist.blank? || !artist.is_banned? || CurrentUser.is_builder?
|
||||
end
|
||||
|
||||
def to_param
|
||||
if title =~ /\A\d+\z/
|
||||
"~#{title}"
|
||||
|
||||
@@ -3,7 +3,6 @@ class WikiPageVersion < ApplicationRecord
|
||||
belongs_to :wiki_page
|
||||
belongs_to_updater
|
||||
belongs_to :artist, optional: true
|
||||
delegate :visible?, :to => :wiki_page
|
||||
|
||||
module SearchMethods
|
||||
def search(params)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
<%= table_for @artist_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||
<% t.column "Name" do |artist_version| %>
|
||||
<% if artist_version.visible? %>
|
||||
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
|
||||
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}) %>
|
||||
|
||||
@@ -14,14 +13,11 @@
|
||||
<p>(group: <%= artist_version.group_name %>)</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Other Names" do |artist_version| %>
|
||||
<% if artist_version.visible? %>
|
||||
<%= artist_version_other_names_diff(artist_version) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "URLs", td: {class: "col-expand"} do |artist_version| %>
|
||||
<%= artist_version_urls_diff(artist_version) if artist_version.visible? %>
|
||||
<%= artist_version_urls_diff(artist_version) %>
|
||||
<% end %>
|
||||
<% t.column "Updated" do |artist_version| %>
|
||||
<%= link_to_user artist_version.updater %>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div id="a-show">
|
||||
<h1>Artist: <%= link_to @artist.pretty_name, posts_path(:tags => @artist.name), :class => "tag-type-#{@artist.category_name}" %></h1>
|
||||
|
||||
<% if @artist.notes.present? && @artist.visible? %>
|
||||
<% if @artist.notes.present? %>
|
||||
<div class="prose">
|
||||
<%= format_text(@artist.notes, :disable_mentions => true) %>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<ul>
|
||||
<li><strong>Status</strong> <%= artist.status %></li>
|
||||
|
||||
<% if !artist.is_banned? || CurrentUser.is_member? %>
|
||||
<% if artist.other_names.present? %>
|
||||
<li><strong>Other Names</strong> <%= link_to_artists(artist.other_names) %></li>
|
||||
<% end %>
|
||||
@@ -34,5 +33,4 @@
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
@@ -2,11 +2,7 @@
|
||||
<div id="a-edit">
|
||||
<h1>Edit Artist</h1>
|
||||
|
||||
<% if @artist.is_banned? %>
|
||||
<p>The artist requested removal of this page.</p>
|
||||
<% else %>
|
||||
<%= render "form" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<%= render layout: "show" do %>
|
||||
<% if @artist.visible? %>
|
||||
<div>
|
||||
<%= render "summary", artist: @artist %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p>The artist requested removal of this page.</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<div id="excerpt" style="display: none;">
|
||||
<% if post_set.artist.present? %>
|
||||
<% post_set.artist.tap do |artist| %>
|
||||
<% if artist.visible? %>
|
||||
<% unless artist.notes.blank? %>
|
||||
<div class="prose">
|
||||
<%= format_text(artist.notes) %>
|
||||
@@ -20,7 +19,6 @@
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% elsif post_set.wiki_page.present? %>
|
||||
<% post_set.wiki_page.tap do |wiki_page| %>
|
||||
<div class="prose">
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<% content_for(:content) do %>
|
||||
<h1>Wiki Page: <%= @thispage.title %></h1>
|
||||
|
||||
<% if @thispage.visible? %>
|
||||
<p>Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)</p>
|
||||
|
||||
<%= wiki_other_names_diff(@thispage, @otherpage) %>
|
||||
@@ -14,7 +13,4 @@
|
||||
<div>
|
||||
<%= wiki_body_diff(@thispage, @otherpage) %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p>The artist requested removal of this page.</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -5,15 +5,11 @@
|
||||
<p class="fineprint"><%= time_ago_in_words_tagged(@wiki_page_version.updated_at) %></p>
|
||||
|
||||
<div id="wiki-page-body" class="dtext prose">
|
||||
<% if @wiki_page_version.visible? %>
|
||||
<% if @wiki_page_version.other_names.present? %>
|
||||
<p><%= wiki_page_other_names_list(@wiki_page_version) %></p>
|
||||
<% end %>
|
||||
|
||||
<%= format_text(@wiki_page_version.body) %>
|
||||
<% else %>
|
||||
<p>The artist has requested removal of this page.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -3,11 +3,7 @@
|
||||
<% content_for(:content) do %>
|
||||
<h1>Edit Wiki</h1>
|
||||
|
||||
<% if @wiki_page.visible? %>
|
||||
<%= render "form" %>
|
||||
<% else %>
|
||||
<p>The artist requested removal of this page.</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
</h1>
|
||||
|
||||
<div id="wiki-page-body" class="prose">
|
||||
<% if @wiki_page.visible? %>
|
||||
<% if @wiki_page.other_names.present? %>
|
||||
<p><%= wiki_page_other_names_list(@wiki_page) %></p>
|
||||
<% end %>
|
||||
@@ -34,9 +33,6 @@
|
||||
<% end %>
|
||||
|
||||
<%= render "tag_relationships/alias_and_implication_list", tag: @wiki_page.tag %>
|
||||
<% else %>
|
||||
<p>This artist has requested removal of their information.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= render "wiki_pages/posts", wiki_page: @wiki_page %>
|
||||
|
||||
Reference in New Issue
Block a user