forked from e621ng/e621ng
[Blacklist] Separate blacklist display for posts and comments (#741)
Apparently, people were really confused by there only being one blacklist before.
This commit is contained in:
parent
a977c4ed47
commit
705254627d
@ -210,7 +210,6 @@ Blacklist.update_styles = function () {
|
||||
for (const filter of Object.values(Blacklist.filters))
|
||||
allPosts = allPosts.concat(Array.from(filter.matchIDs));
|
||||
Blacklist.matchedPosts = new Set(allPosts);
|
||||
console.log("matched", Blacklist.matchedPosts);
|
||||
|
||||
$(".filter-matches").removeClass("filter-matches");
|
||||
for (const postID of Blacklist.matchedPosts)
|
||||
@ -258,6 +257,9 @@ class BlacklistUI {
|
||||
this.$element = $element;
|
||||
this.$counter = $element.find(".blacklisted-count");
|
||||
|
||||
this.post = parseInt($element.attr("post"));
|
||||
this.hasPost = !Number.isNaN(this.post);
|
||||
|
||||
// Collapsable header
|
||||
$element
|
||||
.attr("collapsed", LStorage.Blacklist.Collapsed)
|
||||
@ -308,6 +310,10 @@ class BlacklistUI {
|
||||
for (const [name, filter] of Object.entries(Blacklist.filters)) {
|
||||
if (filter.matchIDs.size == 0) continue;
|
||||
|
||||
// Special case for the posts/show page sidebar
|
||||
if (this.hasPost && !filter.matchIDs.has(this.post))
|
||||
continue;
|
||||
|
||||
activeFilters++;
|
||||
if (!filter.enabled) inactiveFilters++;
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
<%# locals: (post_id: nil) %>
|
||||
|
||||
<section class="blacklist-ui"
|
||||
filters="0"
|
||||
collapsed="true"
|
||||
<% if post_id.presence.present? %>
|
||||
post="<%= post_id %>"
|
||||
<% end %>
|
||||
>
|
||||
<div class="blacklist-header">Blacklisted <span class="blacklisted-count"></span></div>
|
||||
<div class="blacklist-filters"></div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<aside id="sidebar">
|
||||
<%= render "posts/partials/common/search", :path => posts_path, :tags => params[:q], :tags_dom_id => "tags" %>
|
||||
|
||||
<%= render "posts/partials/index/blacklist" %>
|
||||
<%= render "posts/partials/index/blacklist", post_id: @post.id %>
|
||||
|
||||
<section id="tag-list">
|
||||
<%= @post.presenter.post_show_sidebar_tag_list_html(current_query: params[:q], highlighted_tags: @post.uploader_linked_artists.map(&:name)) %>
|
||||
@ -194,6 +194,9 @@
|
||||
<li><a href="#image-and-nav">Image</a></li>
|
||||
<li><a href="#tag-list">Tags/Info</a></li>
|
||||
</ul>
|
||||
|
||||
<%= render "posts/partials/common/inline_blacklist" %>
|
||||
|
||||
<menu id="post-sections">
|
||||
<% unless CurrentUser.hide_comments? %>
|
||||
<li class="active"><a href="#comments">Comments</a></li>
|
||||
|
Loading…
Reference in New Issue
Block a user