From 5df3bf1c271d93343dc59efa7bf2e32eb5c0d22a Mon Sep 17 00:00:00 2001 From: Magnus Bergmark Date: Fri, 13 Jan 2012 11:46:42 +0100 Subject: [PATCH] Use push helpers to format Talker messages This correctly shows the actual pusher when a push happens instead of whomever committed the last commit. It will also make the message a tad more interesting: Joe Pusher created some-branch from master (+2 new commits) instead of Mary Committer pushed 2 commits --- services/talker.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/services/talker.rb b/services/talker.rb index e47a81d39..af46ff3e5 100644 --- a/services/talker.rb +++ b/services/talker.rb @@ -13,12 +13,10 @@ def receive_push http.url_prefix = data['url'] if data['digest'].to_i == 1 and commits.size > 1 - commit = commits.last - message = "#{commit['author']['name']} pushed #{commits.size} commits to [#{repository}/#{branch}] #{payload['compare']}" - http_post 'messages.json', :message => message + http_post 'messages.json', :message => "#{summary_message} – #{summary_url}" else - commits.each do |commit| - message = "#{commit['author']['name']} pushed \"#{commit['message'].split("\n").first}\" - #{commit['url']} to [#{repository}/#{branch}]" + http_post 'messages.json', :message => "#{pusher_name} pushed the following commits:" + commit_messages.each do |message| http_post 'messages.json', :message => message end end