add sanity check for update category post counts method

This commit is contained in:
albert
2013-03-10 00:35:36 -05:00
parent 27926df522
commit f96cd644bc
3 changed files with 7 additions and 5 deletions

View File

@@ -9,14 +9,14 @@
}
Danbooru.PostModeration.hide_or_show_approve_and_disapprove_links = function() {
if (Danbooru.meta("post-is-approvable") != "true") {
if (Danbooru.meta("post-is-approvable") !== "true") {
$("#approve").hide();
$("#disapprove").hide();
}
}
Danbooru.PostModeration.hide_or_show_delete_and_undelete_links = function() {
if (Danbooru.meta("post-is-deleted") == "true") {
if (Danbooru.meta("post-is-deleted") === "true") {
$("#delete").hide();
} else {
$("#undelete").hide();

View File

@@ -98,8 +98,10 @@ class Tag < ActiveRecord::Base
def update_category_post_counts
old_field = "tag_count_#{Danbooru.config.reverse_tag_category_mapping[category_was]}".downcase
new_field = "tag_count_#{category_name}".downcase
Post.without_timeout do
Post.raw_tag_match(name).update_all("#{old_field} = #{old_field} - 1, #{new_field} = #{new_field} + 1")
if old_field != new_field
Post.without_timeout do
Post.raw_tag_match(name).update_all("#{old_field} = #{old_field} - 1, #{new_field} = #{new_field} + 1")
end
end
end

View File

@@ -19,7 +19,7 @@
<%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %>
<%= stylesheet_link_tag "application", :media => "screen" %>
<%= javascript_include_tag "application" %>
<%= Danbooru.config.custom_html_header_content %>
<%= raw Danbooru.config.custom_html_header_content %>
<%= yield :html_header %>
</head>
<body>