Merge branch 'dm-chat-message-backticks' into 'master'

Remove backticks from chat messages because they're not rendered as code

See merge request !12276
This commit is contained in:
Sean McGivern 2017-06-20 11:47:56 +00:00
commit 458c292f41
4 changed files with 16 additions and 16 deletions

View file

@ -70,7 +70,7 @@ module ChatMessage
end end
def branch_link def branch_link
"`[#{ref}](#{branch_url})`" "[#{ref}](#{branch_url})"
end end
def project_link def project_link

View file

@ -61,7 +61,7 @@ module ChatMessage
end end
def removed_branch_message def removed_branch_message
"#{user_name} removed #{ref_type} `#{ref}` from #{project_link}" "#{user_name} removed #{ref_type} #{ref} from #{project_link}"
end end
def push_message def push_message
@ -102,7 +102,7 @@ module ChatMessage
end end
def branch_link def branch_link
"`[#{ref}](#{branch_url})`" "[#{ref}](#{branch_url})"
end end
def project_link def project_link

View file

@ -62,7 +62,7 @@ describe ChatMessage::PipelineMessage do
def build_message(status_text = status, name = user[:name]) def build_message(status_text = status, name = user[:name])
"<http://example.gitlab.com|project_name>:" \ "<http://example.gitlab.com|project_name>:" \
" Pipeline <http://example.gitlab.com/pipelines/123|#123>" \ " Pipeline <http://example.gitlab.com/pipelines/123|#123>" \
" of branch `<http://example.gitlab.com/commits/develop|develop>`" \ " of branch <http://example.gitlab.com/commits/develop|develop>" \
" by #{name} #{status_text} in 02:00:10" " by #{name} #{status_text} in 02:00:10"
end end
end end
@ -81,7 +81,7 @@ describe ChatMessage::PipelineMessage do
expect(subject.pretext).to be_empty expect(subject.pretext).to be_empty
expect(subject.attachments).to eq(message) expect(subject.attachments).to eq(message)
expect(subject.activity).to eq({ expect(subject.activity).to eq({
title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch `[develop](http://example.gitlab.com/commits/develop)` by hacker passed', title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch [develop](http://example.gitlab.com/commits/develop) by hacker passed',
subtitle: 'in [project_name](http://example.gitlab.com)', subtitle: 'in [project_name](http://example.gitlab.com)',
text: 'in 02:00:10', text: 'in 02:00:10',
image: '' image: ''
@ -98,7 +98,7 @@ describe ChatMessage::PipelineMessage do
expect(subject.pretext).to be_empty expect(subject.pretext).to be_empty
expect(subject.attachments).to eq(message) expect(subject.attachments).to eq(message)
expect(subject.activity).to eq({ expect(subject.activity).to eq({
title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch `[develop](http://example.gitlab.com/commits/develop)` by hacker failed', title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch [develop](http://example.gitlab.com/commits/develop) by hacker failed',
subtitle: 'in [project_name](http://example.gitlab.com)', subtitle: 'in [project_name](http://example.gitlab.com)',
text: 'in 02:00:10', text: 'in 02:00:10',
image: '' image: ''
@ -113,7 +113,7 @@ describe ChatMessage::PipelineMessage do
expect(subject.pretext).to be_empty expect(subject.pretext).to be_empty
expect(subject.attachments).to eq(message) expect(subject.attachments).to eq(message)
expect(subject.activity).to eq({ expect(subject.activity).to eq({
title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch `[develop](http://example.gitlab.com/commits/develop)` by API failed', title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch [develop](http://example.gitlab.com/commits/develop) by API failed',
subtitle: 'in [project_name](http://example.gitlab.com)', subtitle: 'in [project_name](http://example.gitlab.com)',
text: 'in 02:00:10', text: 'in 02:00:10',
image: '' image: ''
@ -125,7 +125,7 @@ describe ChatMessage::PipelineMessage do
def build_markdown_message(status_text = status, name = user[:name]) def build_markdown_message(status_text = status, name = user[:name])
"[project_name](http://example.gitlab.com):" \ "[project_name](http://example.gitlab.com):" \
" Pipeline [#123](http://example.gitlab.com/pipelines/123)" \ " Pipeline [#123](http://example.gitlab.com/pipelines/123)" \
" of branch `[develop](http://example.gitlab.com/commits/develop)`" \ " of branch [develop](http://example.gitlab.com/commits/develop)" \
" by #{name} #{status_text} in 02:00:10" " by #{name} #{status_text} in 02:00:10"
end end
end end

View file

@ -28,7 +28,7 @@ describe ChatMessage::PushMessage, models: true do
context 'without markdown' do context 'without markdown' do
it 'returns a message regarding pushes' do it 'returns a message regarding pushes' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'test.user pushed to branch `<http://url.com/commits/master|master>` of '\ 'test.user pushed to branch <http://url.com/commits/master|master> of '\
'<http://url.com|project_name> (<http://url.com/compare/before...after|Compare changes>)') '<http://url.com|project_name> (<http://url.com/compare/before...after|Compare changes>)')
expect(subject.attachments).to eq([{ expect(subject.attachments).to eq([{
text: "<http://url1.com|abcdefgh>: message1 - author1\n\n"\ text: "<http://url1.com|abcdefgh>: message1 - author1\n\n"\
@ -45,7 +45,7 @@ describe ChatMessage::PushMessage, models: true do
it 'returns a message regarding pushes' do it 'returns a message regarding pushes' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'test.user pushed to branch `[master](http://url.com/commits/master)` of [project_name](http://url.com) ([Compare changes](http://url.com/compare/before...after))') 'test.user pushed to branch [master](http://url.com/commits/master) of [project_name](http://url.com) ([Compare changes](http://url.com/compare/before...after))')
expect(subject.attachments).to eq( expect(subject.attachments).to eq(
"[abcdefgh](http://url1.com): message1 - author1\n\n[12345678](http://url2.com): message2 - author2") "[abcdefgh](http://url1.com): message1 - author1\n\n[12345678](http://url2.com): message2 - author2")
expect(subject.activity).to eq({ expect(subject.activity).to eq({
@ -74,7 +74,7 @@ describe ChatMessage::PushMessage, models: true do
context 'without markdown' do context 'without markdown' do
it 'returns a message regarding pushes' do it 'returns a message regarding pushes' do
expect(subject.pretext).to eq('test.user pushed new tag ' \ expect(subject.pretext).to eq('test.user pushed new tag ' \
'`<http://url.com/commits/new_tag|new_tag>` to ' \ '<http://url.com/commits/new_tag|new_tag> to ' \
'<http://url.com|project_name>') '<http://url.com|project_name>')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
end end
@ -87,7 +87,7 @@ describe ChatMessage::PushMessage, models: true do
it 'returns a message regarding pushes' do it 'returns a message regarding pushes' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'test.user pushed new tag `[new_tag](http://url.com/commits/new_tag)` to [project_name](http://url.com)') 'test.user pushed new tag [new_tag](http://url.com/commits/new_tag) to [project_name](http://url.com)')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
expect(subject.activity).to eq({ expect(subject.activity).to eq({
title: 'test.user created tag', title: 'test.user created tag',
@ -107,7 +107,7 @@ describe ChatMessage::PushMessage, models: true do
context 'without markdown' do context 'without markdown' do
it 'returns a message regarding a new branch' do it 'returns a message regarding a new branch' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'test.user pushed new branch `<http://url.com/commits/master|master>` to '\ 'test.user pushed new branch <http://url.com/commits/master|master> to '\
'<http://url.com|project_name>') '<http://url.com|project_name>')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
end end
@ -120,7 +120,7 @@ describe ChatMessage::PushMessage, models: true do
it 'returns a message regarding a new branch' do it 'returns a message regarding a new branch' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'test.user pushed new branch `[master](http://url.com/commits/master)` to [project_name](http://url.com)') 'test.user pushed new branch [master](http://url.com/commits/master) to [project_name](http://url.com)')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
expect(subject.activity).to eq({ expect(subject.activity).to eq({
title: 'test.user created branch', title: 'test.user created branch',
@ -140,7 +140,7 @@ describe ChatMessage::PushMessage, models: true do
context 'without markdown' do context 'without markdown' do
it 'returns a message regarding a removed branch' do it 'returns a message regarding a removed branch' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'test.user removed branch `master` from <http://url.com|project_name>') 'test.user removed branch master from <http://url.com|project_name>')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
end end
end end
@ -152,7 +152,7 @@ describe ChatMessage::PushMessage, models: true do
it 'returns a message regarding a removed branch' do it 'returns a message regarding a removed branch' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'test.user removed branch `master` from [project_name](http://url.com)') 'test.user removed branch master from [project_name](http://url.com)')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
expect(subject.activity).to eq({ expect(subject.activity).to eq({
title: 'test.user removed branch', title: 'test.user removed branch',