This commit is contained in:
r888888888
2014-04-17 14:17:11 -07:00
parent fad0ab7c93
commit 90f3156a73
5 changed files with 27 additions and 9 deletions

View File

@@ -35,11 +35,11 @@ module PostSets
end end
def has_artist? def has_artist?
is_single_tag? && ::Artist.named(tag_string).active.exists? is_single_tag? && artist.present? && artist.visible?
end end
def artist def artist
::Artist.named(tag_string).active.first @artist ||= ::Artist.named(tag_string).active.first
end end
def pool_name def pool_name

View File

@@ -203,4 +203,8 @@ class WikiPage < ActiveRecord::Base
def create_mod_action_for_destroy def create_mod_action_for_destroy
ModAction.create(:description => "permanently deleted wiki page [[#{title}]]") ModAction.create(:description => "permanently deleted wiki page [[#{title}]]")
end end
def visible?
artist.blank? || !artist.is_banned? || CurrentUser.user.is_janitor?
end
end end

View File

@@ -1,6 +1,7 @@
class WikiPageVersion < ActiveRecord::Base class WikiPageVersion < ActiveRecord::Base
belongs_to :wiki_page belongs_to :wiki_page
belongs_to :updater, :class_name => "User" belongs_to :updater, :class_name => "User"
belongs_to :artist
attr_accessible :wiki_page_id, :title, :body, :is_locked, :updater_id, :updater_ip_addr, :version attr_accessible :wiki_page_id, :title, :body, :is_locked, :updater_id, :updater_ip_addr, :version
module SearchMethods module SearchMethods
@@ -37,4 +38,9 @@ class WikiPageVersion < ActiveRecord::Base
def category_name def category_name
Tag.category_for(title) Tag.category_for(title)
end end
def visible?
artist.blank? || !artist.is_banned? || CurrentUser.user.is_janitor?
end
end end

View File

@@ -6,7 +6,11 @@
<h1 id="wiki-page-title"><%= @wiki_page_version.pretty_title %> <span class="version">(<%= time_ago_in_words_tagged(@wiki_page_version.updated_at) %>)</span></h1> <h1 id="wiki-page-title"><%= @wiki_page_version.pretty_title %> <span class="version">(<%= time_ago_in_words_tagged(@wiki_page_version.updated_at) %>)</span></h1>
<div id="wiki-page-body" class="dtext prose"> <div id="wiki-page-body" class="dtext prose">
<%= format_text(@wiki_page_version.body) %> <% if @wiki_page_version.visible? %>
<%= format_text(@wiki_page_version.body) %>
<% else %>
<p>This artist has requested removal of their information.</p>
<% end %>
</div> </div>
</section> </section>
</div> </div>

View File

@@ -13,16 +13,20 @@
</h1> </h1>
<div id="wiki-page-body" class="prose"> <div id="wiki-page-body" class="prose">
<%= format_text(@wiki_page.body) %> <% if @wiki_page.visible? %>
<%= format_text(@wiki_page.body) %>
<% if @wiki_page.artist %> <% if @wiki_page.artist %>
<p><%= link_to "View artist", @wiki_page.artist %></p> <p><%= link_to "View artist", @wiki_page.artist %></p>
<% end %>
<%= wiki_page_alias_and_implication_list(@wiki_page) %>
<% else %>
<p>This artist has requested removal of their information.</p>
<% end %> <% end %>
<%= wiki_page_alias_and_implication_list(@wiki_page) %>
</div> </div>
<%= wiki_page_post_previews(@wiki_page) %> <%= wiki_page_post_previews(@wiki_page) %>
</section> </section>
</div> </div>
</div> </div>