Defect #32125

Issues autocomplete may not find issues with a subject longer than 60 characters

Added by Mizuki ISHIKAWA 12 months ago. Updated 4 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Issues
Target version:4.2.0
Resolution:Fixed Affected version:

Description

Reproduction procedure:
  • Create a issue with subject "-------------------The quick brown fox jumps over the lazy dog."(Subject longer than 60 characters)
  • Check if the created issue is complete (In the textarea of other issues).
    • Write "#brown" => autocompleted
    • Write "#dog" => not autocompleted

"https://----------/issues/auto_complete?q=dog" will return the result as shown below.

[{"id":1,"label":"Bug #1: -------------------The quick brown fox jumps over the laz...","value":1}]

Although the created issue is returned, the label is omitted on the way and the character string such as dog is not included.
(http://www.redmine.org/projects/redmine/repository/entry/trunk/app/controllers/auto_completes_controller.rb#L58)

I think that tribute.js has removed it from the candidate because the search keyword is not included in label.

too-wide-dropdown@2x.png (18.2 KB) Go MAEDA, 2019-11-03 11:59

fix-32125.patch Magnifier (1.72 KB) Mizuki ISHIKAWA, 2019-11-20 05:03

example-1.png (27.9 KB) Mizuki ISHIKAWA, 2019-11-20 05:04

example-2.png (80.1 KB) Mizuki ISHIKAWA, 2019-11-20 05:04

fix-32125-v2.patch Magnifier (1.08 KB) Go MAEDA, 2020-05-11 06:23


Related issues

Blocked by Redmine - Feature #31887: Update jQuery UI to 1.12.1 Closed

Associated revisions

Revision 19771
Added by Go MAEDA 4 months ago

Fix that issues autocomplete may not find issues with a subject longer than 60 characters (#12250).

Contributed by Mizuki ISHIKAWA.

Revision 19772
Added by Go MAEDA 4 months ago

Revert r19771 due to the incorrect issue number in the commit message.

Revision 19773
Added by Go MAEDA 4 months ago

Fix that issues autocomplete may not find issues with a subject longer than 60 characters (#32125).

Contributed by Mizuki ISHIKAWA.

Revision 19775
Added by Go MAEDA 4 months ago

Reverts r19773 (#32125).

The purpose of reverting is to revert r19769 on which r19773 depends.

Revision 19784
Added by Go MAEDA 4 months ago

Fix that issues autocomplete may not find issues with a subject longer than 60 characters (#32125).

Contributed by Mizuki ISHIKAWA.

History

#1 Updated by Mizuki ISHIKAWA 12 months ago

Do I need to return a subject that is shortened to 60 characters?
If not, you can fix the problem by making the changes below.

diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb
index 336885349..bbe5b13ed 100644
--- a/app/controllers/auto_completes_controller.rb
+++ b/app/controllers/auto_completes_controller.rb
@@ -55,7 +55,7 @@ class AutoCompletesController < ApplicationController
   def format_issues_json(issues)
     issues.map {|issue| {
       'id' => issue.id,
-      'label' => "#{issue.tracker} ##{issue.id}: #{issue.subject.to_s.truncate(60)}",
+      'label' => "#{issue.tracker} ##{issue.id}: #{issue.subject}",
       'value' => issue.id
       }
     }

#2 Updated by Go MAEDA 12 months ago

I don't think the truncation is necessary. Even if the truncation is necessary, 60 characters long is too short. It can be raised to 255, the maximum length of string in ActiveRecord.

#3 Updated by Go MAEDA 11 months ago

  • Target version set to Candidate for next major release

#4 Updated by Go MAEDA 11 months ago

After applying the patch, the autocomplete dropdown gets too wide when it includes long subjects. I think we should somehow limit the width of the dropdown when removing truncate(60).

truncate(60) was added in r10068, when Prototype and script.aculo.us were replaced with JQuery. Maybe the replacement caused the issue I described above and truncate(60) was added as a workaround for that.

#5 Updated by Go MAEDA 11 months ago

Go MAEDA wrote:

After applying the patch, the autocomplete dropdown gets too wide when it includes long subjects.

Screenshot of that.

#6 Updated by Mizuki ISHIKAWA 10 months ago

Go MAEDA wrote:

After applying the patch, the autocomplete dropdown gets too wide when it includes long subjects. I think we should somehow limit the width of the dropdown when removing truncate(60).

I attached a patch that omits the subject line if the width exceeds 400px.

#7 Updated by Go MAEDA 5 months ago

  • Target version changed from Candidate for next major release to 4.2.0

Setting the target version to 4.2.0.

#8 Updated by Go MAEDA 4 months ago

I have updated the patch to cleanly applicable after r19769. And I slightly modified as follows:

  • Instead of removing truncate(60) from source:tags/4.1.1/app/controllers/auto_completes_controller.rb#L59, changed to truncate(255). Although the maximum length of a subject is limited to 255 by database schema, the change guarantees that the length of a subject in JSON data will never exceed 255.
  • Since it is ensured that the length of the Subject does not exceed 255, we can say that UI issues due to abnormally long subjects unlikely to occur. So, I simplify the change against CSS. I have removed white-space, text-overflow, and overflow properties from the previous patch.

#9 Updated by Go MAEDA 4 months ago

  • Subject changed from Long subject issue may not autocomplete with #keyword to Issues autocomplete may not find issues with a subject longer than 60 characters

#10 Updated by Go MAEDA 4 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix. Thank you.

#11 Updated by Go MAEDA 4 months ago

#12 Updated by Go MAEDA 4 months ago

  • Status changed from Closed to Reopened
  • Resolution deleted (Fixed)

Reverted r19773.

The revert was necessary to revert r19769 because r19773 depends on the commit.

#13 Updated by Go MAEDA 4 months ago

  • Status changed from Reopened to Closed
  • Resolution set to Fixed

Go MAEDA wrote:

Reverted r19773.

The revert was necessary to revert r19769 because r19773 depends on the commit.

Committed the patch again.

Also available in: Atom PDF