Add config options to disable comments and the forum.

Add options to disable comments, the forum, and autocomplete. This is
for personal boorus and potentially for safe mode. Note that disabling
the forum may cause difficulties with creating and approving BURs.

Disabling comments and the forum merely hides them from most areas,
rather than completely removing them.
This commit is contained in:
evazion
2022-05-18 14:40:53 -05:00
parent 2fe38c1c07
commit 1e78b97eb8
14 changed files with 102 additions and 51 deletions

View File

@@ -208,20 +208,24 @@
</tr>
<% end %>
<tr>
<th>Forum Posts</th>
<td><%= presenter.forum_post_count(self) %></td>
</tr>
<% if Danbooru.config.forum_enabled?.to_s.truthy? %>
<tr>
<th>Forum Posts</th>
<td><%= presenter.forum_post_count(self) %></td>
</tr>
<% end %>
<tr>
<th>Approvals</th>
<td><%= presenter.approval_count(self) %></td>
</tr>
<tr>
<th>Comments</th>
<td><%= presenter.comment_count(self) %> in <%= presenter.commented_posts_count(self) %> posts</td>
</tr>
<% if Danbooru.config.comments_enabled?.to_s.truthy? %>
<tr>
<th>Comments</th>
<td><%= presenter.comment_count(self) %> in <%= presenter.commented_posts_count(self) %> posts</td>
</tr>
<% end %>
<tr>
<th>Appeals</th>

View File

@@ -111,17 +111,21 @@
<div class="user-tooltip-stat-name">Favorites</div>
<% end %>
</li>
<li class="user-tooltip-stat-item">
<%= link_to comments_path(search: { creator_id: @user.id }), class: "link-plain" do %>
<div class="user-tooltip-stat-value"><%= humanized_number(@user.comment_count) %></div>
<div class="user-tooltip-stat-name">Comments</div>
<% end %>
</li>
<li class="user-tooltip-stat-item">
<%= link_to forum_posts_path(search: { creator_id: @user.id }), class: "link-plain" do %>
<div class="user-tooltip-stat-value"><%= humanized_number(@user.forum_post_count) %></div>
<div class="user-tooltip-stat-name">Forum Posts</div>
<% end %>
</li>
<% if Danbooru.config.comments_enabled?.to_s.truthy? %>
<li class="user-tooltip-stat-item">
<%= link_to comments_path(search: { creator_id: @user.id }), class: "link-plain" do %>
<div class="user-tooltip-stat-value"><%= humanized_number(@user.comment_count) %></div>
<div class="user-tooltip-stat-name">Comments</div>
<% end %>
</li>
<% end %>
<% if Danbooru.config.forum_enabled?.to_s.truthy? %>
<li class="user-tooltip-stat-item">
<%= link_to forum_posts_path(search: { creator_id: @user.id }), class: "link-plain" do %>
<div class="user-tooltip-stat-value"><%= humanized_number(@user.forum_post_count) %></div>
<div class="user-tooltip-stat-name">Forum Posts</div>
<% end %>
</li>
<% end %>
</ul>
</div>

View File

@@ -12,5 +12,7 @@
</div>
</div>
<% atom_feed_tag "Comments on #{@user.pretty_name}'s uploads", comments_url(:atom, search: { post_tags_match: "user:#{@user.name}" }) %>
<% atom_feed_tag "Comments on posts commented on by #{@user.pretty_name}", comments_url(:atom, search: { post_tags_match: "commenter:#{@user.name}" }) %>
<% if Danbooru.config.comments_enabled?.to_s.truthy? %>
<% atom_feed_tag "Comments on #{@user.pretty_name}'s uploads", comments_url(:atom, search: { post_tags_match: "user:#{@user.name}" }) %>
<% atom_feed_tag "Comments on posts commented on by #{@user.pretty_name}", comments_url(:atom, search: { post_tags_match: "commenter:#{@user.name}" }) %>
<% end %>