From e49e6f49bb16e3bf74433cd5c14ea2a39d96f6a9 Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 16 Apr 2018 12:10:54 -0500 Subject: [PATCH] Fix #3641: Can't add tags via Add Commentary dialog. --- app/models/artist_commentary.rb | 2 +- test/unit/artist_commentary_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/artist_commentary.rb b/app/models/artist_commentary.rb index ed952bff4..5d8a59885 100644 --- a/app/models/artist_commentary.rb +++ b/app/models/artist_commentary.rb @@ -108,7 +108,7 @@ class ArtistCommentary < ApplicationRecord post.add_tag("check_commentary") end - post.save if post.saved_change_to_tag_string? + post.save if post.tag_string_changed? end module VersionMethods diff --git a/test/unit/artist_commentary_test.rb b/test/unit/artist_commentary_test.rb index 09a7df47e..74c7e0ebd 100644 --- a/test/unit/artist_commentary_test.rb +++ b/test/unit/artist_commentary_test.rb @@ -60,6 +60,11 @@ class ArtistCommentaryTest < ActiveSupport::TestCase @artcomm.reload end + should "add tags if requested" do + @artcomm.update(translated_title: "bar", add_commentary_tag: "1") + assert_equal(true, @post.reload.has_tag?("commentary")) + end + should "not create new version if nothing changed" do @artcomm.save assert_equal(1, @post.artist_commentary.versions.size)