プロジェクト

全般

プロフィール

Vote #78803

完了

Link to user in wiki syntax only works when login is written in lower case

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

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Text formatting_26
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
26
version_id:
99
issue_org_id:
26892
author_id:
105821
assigned_to_id:
1
comments:
13
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
132
ステータス-->[Closed]

説明

Related: #4179

The plugin "Redmine Mentions" gives a handy dropdown with users when hitting "@" on the keyboard. Selecting a user puts "@loginname" in the textbox. This works great with the feature implemented in #4179. However, if the user's login contains capital letters it is not recognized by the regex in application_helper.

"Redmine mentions" puts in the actual login-name with exact casing (what I believe is the correct behaivour).

The regex should be ajusted to a-zA-Z


journals

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

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

--------------------------------------------------------------------------------
Attached is a patch that fixes this issue and it should be applied after #26443.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Marius, I have applied #26443 and I'm getting a failure for the test included in this patch:

<pre>
Failure:
ApplicationHelperTest#test_redmine_links [test/helpers/application_helper_test.rb:406]:
user:JSMITH failed.
Expected: "<p><a class=\"user active\" href=\"/users/2\">John Smith</a></p>"
Actual: "<p>user:JSMITH</p>"
</pre>

Can you have a look please?
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> Marius, I have applied #26443 and I'm getting a failure for the test included in this patch:

This is a workaround for the error.

<pre><code class="diff">
Index: app/helpers/application_helper.rb
===================================================================
--- app/helpers/application_helper.rb (revision 17395)
+++ app/helpers/application_helper.rb (working copy)
@@ -975,12 +975,12 @@
link = link_to_project(p, {:only_path => only_path}, :class => 'project')
end
when 'user'
- u = User.visible.where(:login => name, :type => 'User').first
+ u = User.visible.where("LOWER(login) = :s AND type = 'User'", :s => name.downcase).first
link = link_to_user(u, :only_path => only_path) if u
end
elsif sep == "@"
name = remove_double_quotes(identifier)
- u = User.visible.where(:login => name, :type => 'User').first
+ u = User.visible.where("LOWER(login) = :s AND type = 'User'", :s => name.downcase).first
link = link_to_user(u, :only_path => only_path) if u
end
end
</code></pre>
--------------------------------------------------------------------------------
I agree with the workaround posted above by Go Maeda, it is enough to fix the failing test. It seems that on my local environment, the search is case insensitive and the test doesn't fail.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------

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

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

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


related_issues

relates,Closed,4179,Link to user in wiki syntax
duplicates,Closed,32382,Unreliable User mention feature with PostgreSQL
blocks,Closed,26443,User link syntax (user:login) doesn't work for logins consisting of an email adress

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

  • カテゴリText formatting_26 にセット
  • 対象バージョン4.0.0_99 にセット

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

いいね!0
いいね!0