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:
evazion
2020-01-29 20:11:44 -06:00
parent 74d77c1e23
commit 6b066f2cab
15 changed files with 83 additions and 125 deletions

View File

@@ -2,26 +2,22 @@
<%= 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}) %>
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}) %>
<% if !artist_version.is_active? %>
(deleted)
<% end %>
<% if !artist_version.is_active? %>
(deleted)
<% end %>
<% if artist_version.group_name.present? %>
<p>(group: <%= artist_version.group_name %>)</p>
<% end %>
<% if artist_version.group_name.present? %>
<p>(group: <%= artist_version.group_name %>)</p>
<% end %>
<% end %>
<% t.column "Other Names" do |artist_version| %>
<% if artist_version.visible? %>
<%= artist_version_other_names_diff(artist_version) %>
<% end %>
<%= artist_version_other_names_diff(artist_version) %>
<% 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 %>

View File

@@ -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>

View File

@@ -2,37 +2,35 @@
<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 %>
<% if artist.group_name.present? %>
<li><strong>Group</strong> <%= link_to_artist(artist.group_name) %></li>
<% end %>
<% if artist.members.present? %>
<li><strong>Members</strong> <%= link_to_artists(artist.members.map(&:name)) %></li>
<% end %>
<% if artist.domains.any? %>
<li><strong>Domains</strong></li>
<ul class="list-bulleted">
<% artist.domains.each do |url, count| %>
<li><%= url %>: <%= count %></li>
<% end %>
</ul>
<% end %>
<% if artist.urls.present? %>
<li><strong>URLs</strong></li>
<ul>
<% artist.urls.each do |url| %>
<li>
<% if url.is_active? %>
<%= link_to h(url.to_s), h(url) %>
<% else %>
<del><%= h(url.url) %></del>
<% end %>
</li>
<% end %>
</ul>
<% end %>
<% if artist.other_names.present? %>
<li><strong>Other Names</strong> <%= link_to_artists(artist.other_names) %></li>
<% end %>
<% if artist.group_name.present? %>
<li><strong>Group</strong> <%= link_to_artist(artist.group_name) %></li>
<% end %>
<% if artist.members.present? %>
<li><strong>Members</strong> <%= link_to_artists(artist.members.map(&:name)) %></li>
<% end %>
<% if artist.domains.any? %>
<li><strong>Domains</strong></li>
<ul class="list-bulleted">
<% artist.domains.each do |url, count| %>
<li><%= url %>: <%= count %></li>
<% end %>
</ul>
<% end %>
<% if artist.urls.present? %>
<li><strong>URLs</strong></li>
<ul>
<% artist.urls.each do |url| %>
<li>
<% if url.is_active? %>
<%= link_to h(url.to_s), h(url) %>
<% else %>
<del><%= h(url.url) %></del>
<% end %>
</li>
<% end %>
</ul>
<% end %>
</ul>

View File

@@ -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 %>
<%= render "form" %>
</div>
</div>

View File

@@ -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 %>
<div>
<%= render "summary", artist: @artist %>
</div>
<% end %>

View File

@@ -3,23 +3,21 @@
<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) %>
</div>
<% end %>
<div>
<%= render "artists/summary", artist: artist %>
<%= render "tag_relationships/alias_and_implication_list", tag: artist.tag %>
<p class="links">
<%= link_to "View wiki", artist.wiki_page %> |
<%= link_to "View artist", artist_path(artist.id) %>
</p>
<% unless artist.notes.blank? %>
<div class="prose">
<%= format_text(artist.notes) %>
</div>
<% end %>
<div>
<%= render "artists/summary", artist: artist %>
<%= render "tag_relationships/alias_and_implication_list", tag: artist.tag %>
<p class="links">
<%= link_to "View wiki", artist.wiki_page %> |
<%= link_to "View artist", artist_path(artist.id) %>
</p>
</div>
<% end %>
<% elsif post_set.wiki_page.present? %>
<% post_set.wiki_page.tap do |wiki_page| %>

View File

@@ -6,15 +6,11 @@
<% 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>
<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) %>
<%= wiki_other_names_diff(@thispage, @otherpage) %>
<div>
<%= wiki_body_diff(@thispage, @otherpage) %>
</div>
<% else %>
<p>The artist requested removal of this page.</p>
<% end %>
<div>
<%= wiki_body_diff(@thispage, @otherpage) %>
</div>
<% end %>

View File

@@ -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>
<% if @wiki_page_version.other_names.present? %>
<p><%= wiki_page_other_names_list(@wiki_page_version) %></p>
<% end %>
<%= format_text(@wiki_page_version.body) %>
</div>
<% end %>

View File

@@ -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 %>
<%= render "form" %>
<% end %>
<%= render "secondary_links" %>

View File

@@ -18,25 +18,21 @@
</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 %>
<% if @wiki_page.new_record? %>
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(wiki_page: { title: @wiki_page.title }) %>.</p>
<% else %>
<%= format_text(@wiki_page.body) %>
<% end %>
<% if @wiki_page.artist %>
<p><%= link_to "View artist", @wiki_page.artist %></p>
<% end %>
<%= render "tag_relationships/alias_and_implication_list", tag: @wiki_page.tag %>
<% else %>
<p>This artist has requested removal of their information.</p>
<% if @wiki_page.other_names.present? %>
<p><%= wiki_page_other_names_list(@wiki_page) %></p>
<% end %>
<% if @wiki_page.new_record? %>
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(wiki_page: { title: @wiki_page.title }) %>.</p>
<% else %>
<%= format_text(@wiki_page.body) %>
<% end %>
<% if @wiki_page.artist %>
<p><%= link_to "View artist", @wiki_page.artist %></p>
<% end %>
<%= render "tag_relationships/alias_and_implication_list", tag: @wiki_page.tag %>
</div>
<%= render "wiki_pages/posts", wiki_page: @wiki_page %>