プロジェクト

全般

プロフィール

Vote #80921

未完了

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

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
32
issue_org_id:
33610
author_id:
332
assigned_to_id:
0
comments:
2
status_id:
1
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

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


journals

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.

<pre><code class="diff">
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)
journalize_changes
# 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?
end

# Returns journal details that are visible to user
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Admin Redmine さんが約2年前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョンCandidate for next major release_32 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0