Commit 9e1f25cd577d8d84e6e9fbed02a69a037f0c4141
Exists in
master
and in
1 other branch
Merge pull request #531 from brendonrapp/master
Nicer, friendlier HipChat notification message
Showing
3 changed files
with
5 additions
and
4 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) |
app/views/apps/index.html.haml
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | - if any_github_repos? || any_bitbucket_repos? | 9 | - if any_github_repos? || any_bitbucket_repos? |
10 | %th Repository | 10 | %th Repository |
11 | - if any_notification_services? | 11 | - if any_notification_services? |
12 | - %th Notification Service | 12 | + %th Notify |
13 | - if any_issue_trackers? | 13 | - if any_issue_trackers? |
14 | %th Tracker | 14 | %th Tracker |
15 | - if any_deploys? | 15 | - if any_deploys? |
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') |