From 4c8b1a56d995b09647b24914c9b73e022e58928d Mon Sep 17 00:00:00 2001 From: Toks Date: Thu, 8 Aug 2013 14:12:52 -0400 Subject: [PATCH] #1865: Remove unnecessary safe mode for alias/implications These use Post.raw_tag_match, while the bug only exists when using Post.tag_match. --- app/models/tag_alias.rb | 24 +++++++++++------------- app/models/tag_implication.rb | 16 +++++++--------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/app/models/tag_alias.rb b/app/models/tag_alias.rb index 79ff27bc4..0394d521d 100644 --- a/app/models/tag_alias.rb +++ b/app/models/tag_alias.rb @@ -126,21 +126,19 @@ class TagAlias < ActiveRecord::Base end def update_posts - CurrentUser.without_safe_mode do - Post.without_timeout do - Post.raw_tag_match(antecedent_name).find_each do |post| - escaped_antecedent_name = Regexp.escape(antecedent_name) - fixed_tags = post.tag_string.sub(/(?:\A| )#{escaped_antecedent_name}(?:\Z| )/, " #{consequent_name} ").strip - CurrentUser.scoped(creator, creator_ip_addr) do - post.update_attributes( - :tag_string => fixed_tags - ) - end + Post.without_timeout do + Post.raw_tag_match(antecedent_name).find_each do |post| + escaped_antecedent_name = Regexp.escape(antecedent_name) + fixed_tags = post.tag_string.sub(/(?:\A| )#{escaped_antecedent_name}(?:\Z| )/, " #{consequent_name} ").strip + CurrentUser.scoped(creator, creator_ip_addr) do + post.update_attributes( + :tag_string => fixed_tags + ) end - - antecedent_tag.fix_post_count if antecedent_tag - consequent_tag.fix_post_count if consequent_tag end + + antecedent_tag.fix_post_count if antecedent_tag + consequent_tag.fix_post_count if consequent_tag end end diff --git a/app/models/tag_implication.rb b/app/models/tag_implication.rb index 2ec785693..caa7659ce 100644 --- a/app/models/tag_implication.rb +++ b/app/models/tag_implication.rb @@ -126,15 +126,13 @@ class TagImplication < ActiveRecord::Base end def update_posts - CurrentUser.without_safe_mode do - Post.without_timeout do - Post.raw_tag_match(antecedent_name).find_each do |post| - fixed_tags = "#{post.tag_string} #{descendant_names}".strip - CurrentUser.scoped(creator, creator_ip_addr) do - post.update_attributes( - :tag_string => fixed_tags - ) - end + Post.without_timeout do + Post.raw_tag_match(antecedent_name).find_each do |post| + fixed_tags = "#{post.tag_string} #{descendant_names}".strip + CurrentUser.scoped(creator, creator_ip_addr) do + post.update_attributes( + :tag_string => fixed_tags + ) end end end