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
|
def wiki_page
|
||||||
return nil unless tag.present? && tag.wiki_page.present?
|
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
|
tag.wiki_page
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ module PostSets
|
|||||||
|
|
||||||
def artist
|
def artist
|
||||||
return nil unless tag.present? && tag.category == Tag.categories.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
|
tag.artist
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -538,8 +538,4 @@ class Artist < ApplicationRecord
|
|||||||
"Deleted"
|
"Deleted"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def visible?
|
|
||||||
!is_banned? || CurrentUser.is_gold?
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ class ArtistVersion < ApplicationRecord
|
|||||||
|
|
||||||
belongs_to_updater
|
belongs_to_updater
|
||||||
belongs_to :artist
|
belongs_to :artist
|
||||||
delegate :visible?, :to => :artist
|
|
||||||
|
|
||||||
module SearchMethods
|
module SearchMethods
|
||||||
def search(params)
|
def search(params)
|
||||||
|
|||||||
@@ -244,10 +244,6 @@ class WikiPage < ApplicationRecord
|
|||||||
TagAlias.to_aliased(titles & tags)
|
TagAlias.to_aliased(titles & tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
def visible?
|
|
||||||
artist.blank? || !artist.is_banned? || CurrentUser.is_builder?
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
if title =~ /\A\d+\z/
|
if title =~ /\A\d+\z/
|
||||||
"~#{title}"
|
"~#{title}"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ class WikiPageVersion < ApplicationRecord
|
|||||||
belongs_to :wiki_page
|
belongs_to :wiki_page
|
||||||
belongs_to_updater
|
belongs_to_updater
|
||||||
belongs_to :artist, optional: true
|
belongs_to :artist, optional: true
|
||||||
delegate :visible?, :to => :wiki_page
|
|
||||||
|
|
||||||
module SearchMethods
|
module SearchMethods
|
||||||
def search(params)
|
def search(params)
|
||||||
|
|||||||
@@ -2,26 +2,22 @@
|
|||||||
|
|
||||||
<%= table_for @artist_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
<%= table_for @artist_versions, {class: "striped autofit", width: "100%"} do |t| %>
|
||||||
<% t.column "Name" do |artist_version| %>
|
<% t.column "Name" do |artist_version| %>
|
||||||
<% if artist_version.visible? %>
|
<%= link_to artist_version.name, artist_path(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}) %>
|
||||||
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}) %>
|
|
||||||
|
|
||||||
<% if !artist_version.is_active? %>
|
<% if !artist_version.is_active? %>
|
||||||
(deleted)
|
(deleted)
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if artist_version.group_name.present? %>
|
<% if artist_version.group_name.present? %>
|
||||||
<p>(group: <%= artist_version.group_name %>)</p>
|
<p>(group: <%= artist_version.group_name %>)</p>
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Other Names" do |artist_version| %>
|
<% t.column "Other Names" do |artist_version| %>
|
||||||
<% if artist_version.visible? %>
|
<%= artist_version_other_names_diff(artist_version) %>
|
||||||
<%= artist_version_other_names_diff(artist_version) %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "URLs", td: {class: "col-expand"} do |artist_version| %>
|
<% 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 %>
|
<% end %>
|
||||||
<% t.column "Updated" do |artist_version| %>
|
<% t.column "Updated" do |artist_version| %>
|
||||||
<%= link_to_user artist_version.updater %>
|
<%= link_to_user artist_version.updater %>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div id="a-show">
|
<div id="a-show">
|
||||||
<h1>Artist: <%= link_to @artist.pretty_name, posts_path(:tags => @artist.name), :class => "tag-type-#{@artist.category_name}" %></h1>
|
<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">
|
<div class="prose">
|
||||||
<%= format_text(@artist.notes, :disable_mentions => true) %>
|
<%= format_text(@artist.notes, :disable_mentions => true) %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,37 +2,35 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><strong>Status</strong> <%= artist.status %></li>
|
<li><strong>Status</strong> <%= artist.status %></li>
|
||||||
|
|
||||||
<% if !artist.is_banned? || CurrentUser.is_member? %>
|
<% if artist.other_names.present? %>
|
||||||
<% if artist.other_names.present? %>
|
<li><strong>Other Names</strong> <%= link_to_artists(artist.other_names) %></li>
|
||||||
<li><strong>Other Names</strong> <%= link_to_artists(artist.other_names) %></li>
|
<% end %>
|
||||||
<% end %>
|
<% if artist.group_name.present? %>
|
||||||
<% if artist.group_name.present? %>
|
<li><strong>Group</strong> <%= link_to_artist(artist.group_name) %></li>
|
||||||
<li><strong>Group</strong> <%= link_to_artist(artist.group_name) %></li>
|
<% end %>
|
||||||
<% end %>
|
<% if artist.members.present? %>
|
||||||
<% if artist.members.present? %>
|
<li><strong>Members</strong> <%= link_to_artists(artist.members.map(&:name)) %></li>
|
||||||
<li><strong>Members</strong> <%= link_to_artists(artist.members.map(&:name)) %></li>
|
<% end %>
|
||||||
<% end %>
|
<% if artist.domains.any? %>
|
||||||
<% if artist.domains.any? %>
|
<li><strong>Domains</strong></li>
|
||||||
<li><strong>Domains</strong></li>
|
<ul class="list-bulleted">
|
||||||
<ul class="list-bulleted">
|
<% artist.domains.each do |url, count| %>
|
||||||
<% artist.domains.each do |url, count| %>
|
<li><%= url %>: <%= count %></li>
|
||||||
<li><%= url %>: <%= count %></li>
|
<% end %>
|
||||||
<% end %>
|
</ul>
|
||||||
</ul>
|
<% end %>
|
||||||
<% end %>
|
<% if artist.urls.present? %>
|
||||||
<% if artist.urls.present? %>
|
<li><strong>URLs</strong></li>
|
||||||
<li><strong>URLs</strong></li>
|
<ul>
|
||||||
<ul>
|
<% artist.urls.each do |url| %>
|
||||||
<% artist.urls.each do |url| %>
|
<li>
|
||||||
<li>
|
<% if url.is_active? %>
|
||||||
<% if url.is_active? %>
|
<%= link_to h(url.to_s), h(url) %>
|
||||||
<%= link_to h(url.to_s), h(url) %>
|
<% else %>
|
||||||
<% else %>
|
<del><%= h(url.url) %></del>
|
||||||
<del><%= h(url.url) %></del>
|
<% end %>
|
||||||
<% end %>
|
</li>
|
||||||
</li>
|
<% end %>
|
||||||
<% end %>
|
</ul>
|
||||||
</ul>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -2,11 +2,7 @@
|
|||||||
<div id="a-edit">
|
<div id="a-edit">
|
||||||
<h1>Edit Artist</h1>
|
<h1>Edit Artist</h1>
|
||||||
|
|
||||||
<% if @artist.is_banned? %>
|
<%= render "form" %>
|
||||||
<p>The artist requested removal of this page.</p>
|
|
||||||
<% else %>
|
|
||||||
<%= render "form" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
<%= render layout: "show" do %>
|
<%= render layout: "show" do %>
|
||||||
<% if @artist.visible? %>
|
<div>
|
||||||
<div>
|
<%= render "summary", artist: @artist %>
|
||||||
<%= render "summary", artist: @artist %>
|
</div>
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<p>The artist requested removal of this page.</p>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -3,23 +3,21 @@
|
|||||||
<div id="excerpt" style="display: none;">
|
<div id="excerpt" style="display: none;">
|
||||||
<% if post_set.artist.present? %>
|
<% if post_set.artist.present? %>
|
||||||
<% post_set.artist.tap do |artist| %>
|
<% post_set.artist.tap do |artist| %>
|
||||||
<% if artist.visible? %>
|
<% unless artist.notes.blank? %>
|
||||||
<% unless artist.notes.blank? %>
|
<div class="prose">
|
||||||
<div class="prose">
|
<%= format_text(artist.notes) %>
|
||||||
<%= 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>
|
</div>
|
||||||
<% end %>
|
<% 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 %>
|
<% end %>
|
||||||
<% elsif post_set.wiki_page.present? %>
|
<% elsif post_set.wiki_page.present? %>
|
||||||
<% post_set.wiki_page.tap do |wiki_page| %>
|
<% post_set.wiki_page.tap do |wiki_page| %>
|
||||||
|
|||||||
@@ -6,15 +6,11 @@
|
|||||||
<% content_for(:content) do %>
|
<% content_for(:content) do %>
|
||||||
<h1>Wiki Page: <%= @thispage.title %></h1>
|
<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>
|
<div>
|
||||||
<%= wiki_body_diff(@thispage, @otherpage) %>
|
<%= wiki_body_diff(@thispage, @otherpage) %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
|
||||||
<p>The artist requested removal of this page.</p>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -5,15 +5,11 @@
|
|||||||
<p class="fineprint"><%= time_ago_in_words_tagged(@wiki_page_version.updated_at) %></p>
|
<p class="fineprint"><%= time_ago_in_words_tagged(@wiki_page_version.updated_at) %></p>
|
||||||
|
|
||||||
<div id="wiki-page-body" class="dtext prose">
|
<div id="wiki-page-body" class="dtext prose">
|
||||||
<% if @wiki_page_version.visible? %>
|
<% if @wiki_page_version.other_names.present? %>
|
||||||
<% if @wiki_page_version.other_names.present? %>
|
<p><%= wiki_page_other_names_list(@wiki_page_version) %></p>
|
||||||
<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 %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= format_text(@wiki_page_version.body) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,7 @@
|
|||||||
<% content_for(:content) do %>
|
<% content_for(:content) do %>
|
||||||
<h1>Edit Wiki</h1>
|
<h1>Edit Wiki</h1>
|
||||||
|
|
||||||
<% if @wiki_page.visible? %>
|
<%= render "form" %>
|
||||||
<%= render "form" %>
|
|
||||||
<% else %>
|
|
||||||
<p>The artist requested removal of this page.</p>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "secondary_links" %>
|
<%= render "secondary_links" %>
|
||||||
|
|||||||
@@ -18,25 +18,21 @@
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div id="wiki-page-body" class="prose">
|
<div id="wiki-page-body" class="prose">
|
||||||
<% if @wiki_page.visible? %>
|
<% if @wiki_page.other_names.present? %>
|
||||||
<% if @wiki_page.other_names.present? %>
|
<p><%= wiki_page_other_names_list(@wiki_page) %></p>
|
||||||
<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>
|
|
||||||
<% end %>
|
<% 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>
|
</div>
|
||||||
|
|
||||||
<%= render "wiki_pages/posts", wiki_page: @wiki_page %>
|
<%= render "wiki_pages/posts", wiki_page: @wiki_page %>
|
||||||
|
|||||||
Reference in New Issue
Block a user