]> source.dussan.org Git - redmine.git/commitdiff
Merged r22419 from trunk to 5.0-stable (#38852).
authorMarius Balteanu <marius.balteanu@zitec.com>
Sun, 12 Nov 2023 11:07:53 +0000 (11:07 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Sun, 12 Nov 2023 11:07:53 +0000 (11:07 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22426 e93f8b46-1217-0410-a6f0-8f06a7374b81

public/javascripts/application.js
test/system/inline_autocomplete_test.rb

index 7b2e7725e13bb76e94552ff466a5524ef7cbeb06..dcebb092372cc2cc7a3ec8b0fa0357fafad6ad16 100644 (file)
@@ -1169,7 +1169,12 @@ function inlineAutoComplete(element) {
           fillAttr: 'label',
           requireLeadingSpace: true,
           selectTemplate: function (issue) {
-            return '#' + issue.original.id;
+            let leadingHash = "#"
+            // keep ## syntax which is a valid issue syntax to show issue with title.
+            if (this.currentMentionTextSnapshot.charAt(0) === "#") {
+              leadingHash = "##"
+            }
+            return leadingHash + issue.original.id;
           },
           menuItemTemplate: function (issue) {
             return sanitizeHTML(issue.original.label);
index dbae4137364bda07ae0e8c53c3584b6dc05f8b69..7bf453e6d219afd1f91112b387ca61b025b6e93e 100644 (file)
@@ -42,6 +42,22 @@ class InlineAutocompleteSystemTest < ApplicationSystemTestCase
     assert_equal '#12 ', find('#issue_description').value
   end
 
+  def test_inline_autocomplete_for_issues_with_double_hash_keep_syntax
+    log_user('admin', 'admin')
+    visit 'projects/ecookbook/issues/new'
+
+    fill_in 'Description', :with => '##Closed'
+
+    within('.tribute-container') do
+      assert page.has_text? 'Bug #12: Closed issue on a locked version'
+      assert page.has_text? 'Bug #11: Closed issue on a closed version'
+
+      first('li').click
+    end
+
+    assert_equal '##12 ', find('#issue_description').value
+  end
+
   def test_inline_autocomplete_filters_autocomplete_items
     log_user('jsmith', 'jsmith')
     visit 'issues/new'