hide more pages for banned artists #2132
This commit is contained in:
@@ -3,6 +3,7 @@ class ArtistsController < ApplicationController
|
||||
before_filter :member_only, :except => [:index, :show, :banned]
|
||||
before_filter :builder_only, :only => [:destroy]
|
||||
before_filter :admin_only, :only => [:ban, :unban]
|
||||
before_filter :load_artist, :only => [:ban, :unban, :show, :edit, :update, :destroy, :undelete, :revert]
|
||||
|
||||
def new
|
||||
@artist = Artist.new_with_defaults(params)
|
||||
@@ -10,7 +11,6 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
|
||||
def edit
|
||||
@artist = Artist.find(params[:id])
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
@@ -27,13 +27,11 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
|
||||
def ban
|
||||
@artist = Artist.find(params[:id])
|
||||
@artist.ban!
|
||||
redirect_to(artist_path(@artist), :notice => "Artist was banned")
|
||||
end
|
||||
|
||||
def unban
|
||||
@artist = Artist.find(params[:id])
|
||||
@artist.unban!
|
||||
redirect_to(artist_path(@artist), :notice => "Artist was unbanned")
|
||||
end
|
||||
@@ -73,7 +71,6 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
@artist = Artist.find(params[:id])
|
||||
body = params[:artist].delete("notes")
|
||||
@artist.assign_attributes(params[:artist], :as => CurrentUser.role)
|
||||
if body
|
||||
@@ -84,7 +81,6 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy
|
||||
@artist = Artist.find(params[:id])
|
||||
if !@artist.deletable_by?(CurrentUser.user)
|
||||
raise User::PrivilegeError
|
||||
end
|
||||
@@ -93,7 +89,6 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
|
||||
def undelete
|
||||
@artist = Artist.find(params[:id])
|
||||
if !@artist.deletable_by?(CurrentUser.user)
|
||||
raise User::PrivilegeError
|
||||
end
|
||||
@@ -102,7 +97,6 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
|
||||
def revert
|
||||
@artist = Artist.find(params[:id])
|
||||
@version = ArtistVersion.find(params[:version_id])
|
||||
@artist.revert_to!(@version)
|
||||
respond_with(@artist)
|
||||
@@ -131,4 +125,11 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_artist
|
||||
@artist = Artist.find(params[:id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ class ArtistVersion < ActiveRecord::Base
|
||||
belongs_to :updater, :class_name => "User"
|
||||
belongs_to :artist
|
||||
attr_accessible :artist_id, :name, :is_active, :other_names, :group_name, :url_string, :is_banned, :updater_id, :updater_ip_addr
|
||||
delegate :visible?, :to => :artist
|
||||
|
||||
module SearchMethods
|
||||
def for_user(user_id)
|
||||
|
||||
@@ -3,6 +3,7 @@ class WikiPageVersion < ActiveRecord::Base
|
||||
belongs_to :updater, :class_name => "User"
|
||||
belongs_to :artist
|
||||
attr_accessible :wiki_page_id, :title, :body, :is_locked, :updater_id, :updater_ip_addr, :version, :other_names
|
||||
delegate :visible?, :to => :wiki_page
|
||||
|
||||
module SearchMethods
|
||||
def for_user(user_id)
|
||||
|
||||
@@ -24,11 +24,15 @@
|
||||
<tbody>
|
||||
<% @artist_versions.each do |artist_version| %>
|
||||
<tr class="<%= cycle 'even', 'odd' %>">
|
||||
<td>
|
||||
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
|
||||
</td>
|
||||
<td><%= artist_version_other_names_diff(artist_version) %></td>
|
||||
<td><%= artist_version.group_name %></td>
|
||||
<% if artist_version.visible? %>
|
||||
<td><%= link_to artist_version.name, artist_path(artist_version.artist_id) %></td>
|
||||
<td><%= artist_version_other_names_diff(artist_version) %></td>
|
||||
<td><%= artist_version.group_name %></td>
|
||||
<% else %>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<% end %>
|
||||
<td><%= compact_time artist_version.created_at %></td>
|
||||
<td><%= link_to_user artist_version.updater %></td>
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
@@ -37,11 +41,11 @@
|
||||
</td>
|
||||
<% end %>
|
||||
<td><%= artist_version.is_active? %></td>
|
||||
<td>
|
||||
<ul>
|
||||
<%= artist_version_urls_diff(artist_version) %>
|
||||
</ul>
|
||||
</td>
|
||||
<% if artist_version.visible? %>
|
||||
<td><ul><%= artist_version_urls_diff(artist_version) %></ul></td>
|
||||
<% else %>
|
||||
<td></td>
|
||||
<% end %>
|
||||
<% if CurrentUser.is_member? %>
|
||||
<td>
|
||||
<%= link_to "Revert to", revert_artist_path(artist_version.artist_id, :version_id => artist_version.id), :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<div id="c-artists">
|
||||
<div id="a-edit">
|
||||
<h1>Edit Artist</h1>
|
||||
<%= render "form" %>
|
||||
|
||||
<% if @artist.visible? %>
|
||||
<%= render "form" %>
|
||||
<% else %>
|
||||
<p>The artist requested removal of this page.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,7 +2,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.is_banned? || CurrentUser.user.is_member?) %>
|
||||
<% if @artist.notes.present? && @artist.visible? %>
|
||||
<div class="prose">
|
||||
<%= format_text(@artist.notes) %>
|
||||
</div>
|
||||
@@ -10,34 +10,39 @@
|
||||
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
<li><strong>Status</strong> <%= @artist.status %></li>
|
||||
<% if @artist.visible? %>
|
||||
<div>
|
||||
<ul>
|
||||
<li><strong>Status</strong> <%= @artist.status %></li>
|
||||
|
||||
<% if !@artist.is_banned? || CurrentUser.user.is_member? %>
|
||||
<% if @artist.has_tag_alias? %>
|
||||
<li><strong>Tag Alias</strong> <%= @artist.tag_alias_name %></li>
|
||||
<% if !@artist.is_banned? || CurrentUser.user.is_member? %>
|
||||
<% if @artist.has_tag_alias? %>
|
||||
<li><strong>Tag Alias</strong> <%= @artist.tag_alias_name %></li>
|
||||
<% end %>
|
||||
<% if @artist.other_names.present? %>
|
||||
<li><strong>Other Names</strong> <%= link_to_artists(@artist.other_names.split(/ /)) %></li>
|
||||
<% end %>
|
||||
<% if @artist.group_name.present? %>
|
||||
<li><strong>Group</strong> <%= link_to_artist(@artist.group_name) %></li>
|
||||
<% end %>
|
||||
<% if @artist.members.any? %>
|
||||
<li><strong>Members</strong> <%= link_to_artists(@artist.members.map(&:name)) %></li>
|
||||
<% end %>
|
||||
<% @artist.urls.each do |url| %>
|
||||
<li>
|
||||
URL: <%= link_to h(url.to_s), h(url.to_s) %>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
(<%= link_to("mass edit", edit_moderator_tag_path(:antecedent => "-#{@artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => @artist.name)) %>)
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @artist.other_names.present? %>
|
||||
<li><strong>Other Names</strong> <%= link_to_artists(@artist.other_names.split(/ /)) %></li>
|
||||
<% end %>
|
||||
<% if @artist.group_name.present? %>
|
||||
<li><strong>Group</strong> <%= link_to_artist(@artist.group_name) %></li>
|
||||
<% end %>
|
||||
<% if @artist.members.any? %>
|
||||
<li><strong>Members</strong> <%= link_to_artists(@artist.members.map(&:name)) %></li>
|
||||
<% end %>
|
||||
<% @artist.urls.each do |url| %>
|
||||
<li>
|
||||
URL: <%= link_to h(url.to_s), h(url.to_s) %>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
(<%= link_to("mass edit", edit_moderator_tag_path(:antecedent => "-#{@artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => @artist.name)) %>)
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
<p>The artist requested removal of this page.</p>
|
||||
<% end %>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
</div>
|
||||
|
||||
@@ -4,43 +4,45 @@
|
||||
|
||||
<div id="excerpt" style="display: none;">
|
||||
<% if post_set.has_artist? %>
|
||||
<% unless post_set.artist.notes.blank? %>
|
||||
<div class="prose">
|
||||
<%= format_text(post_set.artist.notes) %>
|
||||
<% if post_set.artist.visible? %>
|
||||
<% unless post_set.artist.notes.blank? %>
|
||||
<div class="prose">
|
||||
<%= format_text(post_set.artist.notes) %>
|
||||
</div>
|
||||
|
||||
<p><%= link_to "View wiki page", post_set.artist.wiki_page %></p>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
<li><strong>Status</strong> <%= post_set.artist.status %></li>
|
||||
<% if post_set.artist.has_tag_alias? %>
|
||||
<li><strong>Tag Alias</strong> <%= post_set.artist.tag_alias_name %></li>
|
||||
<% end %>
|
||||
<% if post_set.artist.other_names.present? %>
|
||||
<li><strong>Other Names</strong> <%= link_to_artists(post_set.artist.other_names.split(/ /)) %></li>
|
||||
<% end %>
|
||||
<% if post_set.artist.group_name.present? %>
|
||||
<li><strong>Group</strong> <%= link_to_artist(post_set.artist.group_name) %></li>
|
||||
<% end %>
|
||||
<% if post_set.artist.members.any? %>
|
||||
<li><strong>Members</strong> <%= link_to_artists(post_set.artist.members.map(&:name)) %></li>
|
||||
<% end %>
|
||||
<% post_set.artist.urls.each do |url| %>
|
||||
<li>
|
||||
URL: <%= link_to h(url.to_s), h(url.to_s) %>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
(<%= link_to("mass edit", edit_moderator_tag_path(:antecedent => "-#{post_set.artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => post_set.artist.name)) %>)
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<%= artist_alias_and_implication_list(post_set.artist) %>
|
||||
|
||||
<p><%= link_to "View artist", artist_path(post_set.artist.id) %></p>
|
||||
</div>
|
||||
|
||||
<p><%= link_to "View wiki page", post_set.artist.wiki_page %></p>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
<li><strong>Status</strong> <%= post_set.artist.status %></li>
|
||||
<% if post_set.artist.has_tag_alias? %>
|
||||
<li><strong>Tag Alias</strong> <%= post_set.artist.tag_alias_name %></li>
|
||||
<% end %>
|
||||
<% if post_set.artist.other_names.present? %>
|
||||
<li><strong>Other Names</strong> <%= link_to_artists(post_set.artist.other_names.split(/ /)) %></li>
|
||||
<% end %>
|
||||
<% if post_set.artist.group_name.present? %>
|
||||
<li><strong>Group</strong> <%= link_to_artist(post_set.artist.group_name) %></li>
|
||||
<% end %>
|
||||
<% if post_set.artist.members.any? %>
|
||||
<li><strong>Members</strong> <%= link_to_artists(post_set.artist.members.map(&:name)) %></li>
|
||||
<% end %>
|
||||
<% post_set.artist.urls.each do |url| %>
|
||||
<li>
|
||||
URL: <%= link_to h(url.to_s), h(url.to_s) %>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
(<%= link_to("mass edit", edit_moderator_tag_path(:antecedent => "-#{post_set.artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => post_set.artist.name)) %>)
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<%= artist_alias_and_implication_list(post_set.artist) %>
|
||||
|
||||
<p><%= link_to "View artist", artist_path(post_set.artist.id) %></p>
|
||||
</div>
|
||||
<% elsif post_set.has_wiki? %>
|
||||
<div class="prose">
|
||||
<% if post_set.wiki_page.other_names.present? %>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<% if post.is_banned? %>
|
||||
<div class="ui-corner-all ui-state-highlight notice notice-deleted">
|
||||
This post was removed because it was requested by the artist
|
||||
The artist requested removal of this page
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<h1>Access Denied</h1>
|
||||
|
||||
<p>You do not have permission to visit this page.</p>
|
||||
|
||||
<%= link_to "Go back", :back, :rel => "prev" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
<div id="a-diff">
|
||||
<h1>Wiki Page: <%= @thispage.title %></h1>
|
||||
|
||||
<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>
|
||||
<% 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>
|
||||
|
||||
<div>
|
||||
<%= wiki_page_diff(@thispage, @otherpage) %>
|
||||
</div>
|
||||
<div>
|
||||
<%= wiki_page_diff(@thispage, @otherpage) %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p>The artist requested removal of this page.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<%= format_text(@wiki_page_version.body) %>
|
||||
<% else %>
|
||||
<p>This artist has requested removal of their information.</p>
|
||||
<p>The artist has requested removal of this page.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -4,7 +4,12 @@
|
||||
|
||||
<section id="content">
|
||||
<h1>Edit Wiki</h1>
|
||||
<%= render "form" %>
|
||||
|
||||
<% if @wiki_page.visible? %>
|
||||
<%= render "form" %>
|
||||
<% else %>
|
||||
<p>The artist requested removal of this page.</p>
|
||||
<% end %>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user