From f716bd8793ab0a2fe9e7fe8ec85b21e60d2860bc Mon Sep 17 00:00:00 2001 From: Tarrgon <61888458+DontTalkToMeThx@users.noreply.github.com> Date: Sun, 1 Sep 2024 14:41:56 -0400 Subject: [PATCH] [Posts] Re-add the warning for removing an implicated tag (#712) --- app/models/post.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index cfd6cc841..3797c86e7 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -410,7 +410,11 @@ class Post < ApplicationRecord module TagMethods def should_process_tags? - tag_string_changed? || locked_tags_changed? || tag_string_diff.present? + if @removed_tags.nil? + @removed_tags = [] + end + + tag_string_changed? || locked_tags_changed? || tag_string_diff.present? || @removed_tags.length > 0 || added_tags.length > 0 end def tag_array @@ -469,8 +473,6 @@ class Post < ApplicationRecord end def merge_old_changes - @removed_tags = [] - if old_tag_string # If someone else committed changes to this post before we did, # then try to merge the tag changes together. @@ -503,7 +505,6 @@ class Post < ApplicationRecord end def apply_tag_diff - @removed_tags = [] return unless tag_string_diff.present? current_tags = tag_array @@ -1644,6 +1645,8 @@ class Post < ApplicationRecord unremoved_tags_list = unremoved_tags.map {|t| "[[#{t}]]"}.to_sentence self.warnings.add(:base, "#{unremoved_tags_list} could not be removed. Check for implications and locked tags and try again") end + + @removed_tags = [] end def has_artist_tag