Commit 1eed79c8e1c090c2319d37fe9ea95da2b628338c

Authored by Brendon Rapp
1 parent f2e95433
Exists in master and in 1 other branch production

Much nicer looking HipChat notification message

app/models/notification_services/hipchat_service.rb
... ... @@ -24,8 +24,9 @@ if defined? HipChat
24 24 def create_notification(problem)
25 25 url = app_problem_url problem.app, problem
26 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 + &nbsp;&nbsp;#{ERB::Util.html_escape problem.message.to_s.truncate(100)}<br>
  29 + &nbsp;&nbsp;Times occurred: #{problem.notices_count}
29 30 MSG
30 31  
31 32 client = HipChat::Client.new(api_token)
... ...
spec/models/notification_service/hipchat_service_spec.rb
... ... @@ -15,7 +15,7 @@ describe NotificationServices::HipchatService do
15 15 end
16 16  
17 17 it 'escapes html in message' do
18   - service.stub(:notification_description => '<3')
  18 + problem.stub(:message => '<3')
19 19 room.should_receive(:send) do |_, message|
20 20 message.should_not include('<3')
21 21 message.should include('&lt;3')
... ...