Link to user in wiki syntax (#4179).

Patch by Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@16636 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2017-06-07 20:10:57 +00:00
parent c513037c6e
commit f902860955
4 changed files with 48 additions and 11 deletions

View File

@@ -383,12 +383,25 @@ RAW
# invalid expressions
'source:' => 'source:',
# url hash
"http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>',
"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)),
'@jsmith' => link_to_user(User.find_by_id(2)),
# invalid user
'user:foobar' => 'user:foobar',
}
@project = Project.find(1)
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" }
end
def test_user_links_with_email_as_login_name_should_not_be_parsed
u = User.generate!(:login => 'jsmith@somenet.foo')
raw = "@jsmith@somenet.foo should not be parsed in jsmith@somenet.foo"
assert_match %r{<p><a class="user active".*>#{u.name}</a> should not be parsed in <a class="email" href="mailto:jsmith@somenet.foo">jsmith@somenet.foo</a></p>},
textilizable(raw, :project => Project.find(1))
end
def test_should_not_parse_redmine_links_inside_link
raw = "r1 should not be parsed in http://example.com/url-r1/"
assert_match %r{<p><a class="changeset".*>r1</a> should not be parsed in <a class="external" href="http://example.com/url-r1/">http://example.com/url-r1/</a></p>},