Project

General

Profile

Actions

Defect #26892

closed

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

Defect #26892: Link to user in wiki syntax only works when login is written in lower case

Added by Anders Thomsen about 9 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Category:
Text formatting
Target version:
Resolution:
Fixed
Affected version:

Description

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


Files


Related issues 3 (0 open — 3 closed)

Related to Redmine - Feature #4179: Link to user in wiki syntaxClosedJean-Philippe LangActions
Has duplicate Redmine - Defect #32382: Unreliable User mention feature with PostgreSQLClosedActions
Blocked by Redmine - Defect #26443: User link syntax (user:login) doesn't work for logins consisting of an email adressClosedMarius BĂLTEANUActions

Updated by Go MAEDA about 9 years ago Actions #1

Updated by Toshi MARUYAMA about 9 years ago Actions #2

  • Target version set to 4.1.0

Updated by Marius BĂLTEANU over 8 years ago Actions #3

  • Blocked by Defect #26443: User link syntax (user:login) doesn't work for logins consisting of an email adress added

Updated by Marius BĂLTEANU over 8 years ago Actions #4

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

Updated by Marius BĂLTEANU over 8 years ago Actions #5

  • Status changed from New to Confirmed

Updated by Jean-Philippe Lang over 8 years ago Actions #6

  • Assignee set to Marius BĂLTEANU

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

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>" 

Can you have a look please?

Updated by Go MAEDA over 8 years ago Actions #7

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.

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

Updated by Marius BĂLTEANU over 8 years ago Actions #8

  • Assignee deleted (Marius BĂLTEANU)
  • Target version changed from 4.1.0 to 4.0.0

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.

Updated by Go MAEDA over 8 years ago Actions #9

  • Assignee set to Jean-Philippe Lang

Updated by Jean-Philippe Lang about 8 years ago Actions #10

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

Committed, thanks.

Updated by Mischa The Evil about 7 years ago Actions #11

  • Related to Defect #32382: Unreliable User mention feature with PostgreSQL added

Updated by Marius BĂLTEANU over 6 years ago Actions #12

  • Related to deleted (Defect #32382: Unreliable User mention feature with PostgreSQL)

Updated by Marius BĂLTEANU over 6 years ago Actions #13

  • Has duplicate Defect #32382: Unreliable User mention feature with PostgreSQL added
Actions

Also available in: PDF Atom