Feature #4179 » link_to_user_profile_by_id.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
| 967 | 967 |
link = link_to_project(p, {:only_path => only_path}, :class => 'project')
|
| 968 | 968 |
end |
| 969 | 969 |
when 'user' |
| 970 |
u = User.visible.where(:login => name, :type => 'User').first |
|
| 970 |
if name =~ /^[0-9]+$/ |
|
| 971 |
u = User.visible.where(:id => name.to_i, :type => 'User').first |
|
| 972 |
else |
|
| 973 |
u = User.visible.where(:login => name, :type => 'User').first |
|
| 974 |
end |
|
| 971 | 975 |
link = link_to_user(u) if u |
| 972 | 976 |
end |
| 973 | 977 |
elsif sep == "@" |
| test/unit/helpers/application_helper_test.rb | ||
|---|---|---|
| 386 | 386 |
"http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>', |
| 387 | 387 |
# user |
| 388 | 388 |
'user:jsmith' => link_to_user(User.find_by_id(2)), |
| 389 |
'user:2' => link_to_user(User.find_by_id(2)), |
|
| 389 | 390 |
'@jsmith' => link_to_user(User.find_by_id(2)), |
| 390 | 391 |
# invalid user |
| 391 | 392 |
'user:foobar' => 'user:foobar', |