Skip to content

Commit

Permalink
Merge pull request #12355 from kraptor/master
Browse files Browse the repository at this point in the history
Add support to render usernames with dots
  • Loading branch information
krauselukas committed Mar 25, 2022
2 parents f758077 + a861a0a commit a7cd353
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api/lib/obsapi/markdown_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def preprocess(fulldoc)
# request#12345 links
fulldoc.gsub!(/(sr|req|request)#(\d+)/i) { |s| "[#{s}](#{request_show_url(number: Regexp.last_match(2))})" }
# @user links
fulldoc.gsub!(/([^\w]|^)@(\b[-\w]+\b)(?:\b|$)/) \
fulldoc.gsub!(/([^\w]|^)@(\b[-.\w]+\b)(?:\b|$)/) \
{ "#{Regexp.last_match(1)}[@#{Regexp.last_match(2)}](#{user_url(Regexp.last_match(2))})" }
# bnc#12345 links
IssueTracker.all.each do |t|
Expand Down
5 changes: 3 additions & 2 deletions src/api/spec/helpers/webui/markdown_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
end

it 'detects all the mentions to users' do
expect(render_as_markdown('@alfie @milo and @Admin, please review. Also you, @test1.')).to eq(
expect(render_as_markdown('@alfie @milo and @Admin, please review. Also you, @test1 and @user.name.')).to eq(
"<p><a href=\"https://unconfigured.openbuildservice.org/users/alfie\">@alfie</a> \
<a href=\"https://unconfigured.openbuildservice.org/users/milo\">@milo</a> \
and <a href=\"https://unconfigured.openbuildservice.org/users/Admin\">@Admin</a>, \
please review. Also you, <a href=\"https://unconfigured.openbuildservice.org/users/test1\">@test1</a>.</p>\n"
please review. Also you, <a href=\"https://unconfigured.openbuildservice.org/users/test1\">@test1</a> \
and <a href=\"https://unconfigured.openbuildservice.org/users/user.name\">@user.name</a>.</p>\n"
)
end

Expand Down

0 comments on commit a7cd353

Please sign in to comment.