diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4915cdd..bc7f8d0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -967,7 +967,11 @@ module ApplicationHelper link = link_to_project(p, {:only_path => only_path}, :class => 'project') end when 'user' - u = User.visible.where(:login => name, :type => 'User').first + if name =~ /^[0-9]+$/ + u = User.visible.where(:id => name.to_i, :type => 'User').first + else + u = User.visible.where(:login => name, :type => 'User').first + end link = link_to_user(u) if u end elsif sep == "@" diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 678dcfd..847fc0c 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -386,6 +386,7 @@ RAW "http://foo.bar/FAQ#3" => 'http://foo.bar/FAQ#3', # user 'user:jsmith' => link_to_user(User.find_by_id(2)), + 'user:2' => link_to_user(User.find_by_id(2)), '@jsmith' => link_to_user(User.find_by_id(2)), # invalid user 'user:foobar' => 'user:foobar',