Project

General

Profile

Actions

Defect #39932

closed

Incorrect position of "Edited" mark in issue notes with h4 headings

Added by Yasu Saku 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

"Edited tag" position is incorrect after issue note update, but it is correct after the page is reloaded.

Steps to reproduce:

  1. Edit the existing note using the Edit Note button in the issue history.
  2. Update note containing H4 tags.

My Environment:

  Redmine version                5.1.1.stable
  Ruby version                   3.2.2-p53 (2023-03-30) [x86_64-linux]
  Rails version                  6.1.7.6

Proposal:

To resolve this issue, I believe it might be sufficient to make corrections to the following sections.

diff --git a/app/views/journals/update.js.erb b/app/views/journals/update.js.erb
index 87320c5d4a..0b9f99a31a 100644
--- a/app/views/journals/update.js.erb
+++ b/app/views/journals/update.js.erb
@@ -7,7 +7,7 @@
   $("#journal-<%= @journal.id %>-notes").replaceWith('<%= escape_javascript(render_notes(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>');
   $("#journal-<%= @journal.id %>-notes").show();
   $("#journal-<%= @journal.id %>-form").remove();
-  var journal_header = $("#change-<%= @journal.id %> h4");
+  var journal_header = $("#change-<%= @journal.id %>>div.note>h4.note-header");
   var journal_updated_info = journal_header.find("span.update-info");
   if (journal_updated_info.length > 0) {
     journal_updated_info.replaceWith('<%= escape_javascript(render_journal_update_info(@journal)) %>');

source:/tags/5.1.1/app/views/journals/update.js.erb#L10


Files

journal_edit.png (133 KB) journal_edit.png Yasu Saku, 2023-12-24 10:39
Actions #1

Updated by Go MAEDA 4 months ago

  • Status changed from New to Confirmed

Thank you for reporting and fixing the issue.

But I think that adding note-hader class to the h4 element is enough to target the correct h4 element. It is less likely to break if there are minor changes in the HTML structure.

diff --git a/app/views/journals/update.js.erb b/app/views/journals/update.js.erb
index 87320c5d4..37ba35602 100644
--- a/app/views/journals/update.js.erb
+++ b/app/views/journals/update.js.erb
@@ -7,7 +7,7 @@
   $("#journal-<%= @journal.id %>-notes").replaceWith('<%= escape_javascript(render_notes(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>');
   $("#journal-<%= @journal.id %>-notes").show();
   $("#journal-<%= @journal.id %>-form").remove();
-  var journal_header = $("#change-<%= @journal.id %> h4");
+  var journal_header = $("#change-<%= @journal.id %> h4.note-header");
   var journal_updated_info = journal_header.find("span.update-info");
   if (journal_updated_info.length > 0) {
     journal_updated_info.replaceWith('<%= escape_javascript(render_journal_update_info(@journal)) %>');
Actions #2

Updated by Go MAEDA 4 months ago

  • Target version set to 5.1.2
Actions #3

Updated by Go MAEDA 4 months ago

  • Subject changed from "Edited tag" position is incorrect after issue note update to Incorrect position of "Edited" mark in journals with h4 headings
  • Status changed from Confirmed to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r22561.

Actions #4

Updated by Go MAEDA 4 months ago

  • Subject changed from Incorrect position of "Edited" mark in journals with h4 headings to Incorrect position of "Edited" mark in issue notes with h4 headings
Actions #5

Updated by Yasu Saku 4 months ago

Mr. Go MAEDA , thank you for your prompt response.

Actions #6

Updated by Go MAEDA 4 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF