Feature #4179 » link_to_user_profile_by_id.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
|
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 == "@"
|
||
| test/unit/helpers/application_helper_test.rb | ||
|---|---|---|
|
"http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>',
|
||
|
# 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',
|
||