Commit 1eed79c8e1c090c2319d37fe9ea95da2b628338c
1 parent
f2e95433
Exists in
master
and in
1 other branch
Much nicer looking HipChat notification message
Showing
2 changed files
with
4 additions
and
3 deletions
Show diff stats
app/models/notification_services/hipchat_service.rb
@@ -24,8 +24,9 @@ if defined? HipChat | @@ -24,8 +24,9 @@ if defined? HipChat | ||
24 | def create_notification(problem) | 24 | def create_notification(problem) |
25 | url = app_problem_url problem.app, problem | 25 | url = app_problem_url problem.app, problem |
26 | message = <<-MSG.strip_heredoc | 26 | message = <<-MSG.strip_heredoc |
27 | - [#{ERB::Util.html_escape problem.app.name}]#{ERB::Util.html_escape notification_description(problem)}<br> | ||
28 | - <a href="#{url}">#{url}</a> | 27 | + <strong>#{ERB::Util.html_escape problem.app.name}</strong> error in <strong>#{ERB::Util.html_escape problem.environment}</strong> at <strong>#{ERB::Util.html_escape problem.where}</strong> (<a href="#{url}">details</a>)<br> |
28 | + #{ERB::Util.html_escape problem.message.to_s.truncate(100)}<br> | ||
29 | + Times occurred: #{problem.notices_count} | ||
29 | MSG | 30 | MSG |
30 | 31 | ||
31 | client = HipChat::Client.new(api_token) | 32 | client = HipChat::Client.new(api_token) |
spec/models/notification_service/hipchat_service_spec.rb
@@ -15,7 +15,7 @@ describe NotificationServices::HipchatService do | @@ -15,7 +15,7 @@ describe NotificationServices::HipchatService do | ||
15 | end | 15 | end |
16 | 16 | ||
17 | it 'escapes html in message' do | 17 | it 'escapes html in message' do |
18 | - service.stub(:notification_description => '<3') | 18 | + problem.stub(:message => '<3') |
19 | room.should_receive(:send) do |_, message| | 19 | room.should_receive(:send) do |_, message| |
20 | message.should_not include('<3') | 20 | message.should_not include('<3') |
21 | message.should include('<3') | 21 | message.should include('<3') |