Defect #33610

Submitting the edit issue form without changing any field updates updated_on column

Added by Go MAEDA over 2 years ago. Updated about 2 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:


Target version:Candidate for next major release
Resolution: Affected version:


The procedure below updates updated_on column in issues table, even though any fields on the issue are not updated and no journal is created.

Steps to reproduce:

1. Open the edit issue form
2. Click the Submit button without changing any value
3. The timestamp of the issue is updated but no journal is created

The behavior I expect:
The updated_on column should not be updated when no changes are made

fix-33610.patch Magnifier (1.81 KB) Yuichi HARADA, 2020-06-26 04:27


#1 Updated by Yuichi HARADA over 2 years ago

I've confirmed.
In the Journal model, Journal#save (source:trunk/app/models/journal.rb#L85) will not run if notes and details are empty.
I think that it will be solved if the same judgment is performed as follows.

diff --git a/app/models/issue.rb b/app/models/issue.rb
index a89f23dd8..5027376f7 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -1853,7 +1853,7 @@ class Issue < ActiveRecord::Base
   # Make sure updated_on is updated when adding a note and set updated_on now
   # so we can set closed_on with the same value on closing
   def force_updated_on_change
-    if @current_journal || changed?
+    if changed? || (@current_journal && !@current_journal.notes_and_details_empty?)
       self.updated_on = current_time_from_proper_timezone
       if new_record?
         self.created_on = updated_on
diff --git a/app/models/journal.rb b/app/models/journal.rb
index e60605161..48d06fbef 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -82,7 +82,11 @@ class Journal < ActiveRecord::Base
   def save(*args)
     # Do not save an empty journal
-    (details.empty? && notes.blank?) ? false : super
+    notes_and_details_empty? ? false : super
+  end
+  def notes_and_details_empty?
+    notes.blank? && details.empty?

   # Returns journal details that are visible to user

#2 Updated by Go MAEDA about 2 years ago

  • Target version set to Candidate for next major release

Also available in: Atom PDF