diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-11 09:29:40 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-11 09:29:40 +0000 |
commit | 04d1128b8a32022d4eb68694c007245936620b39 (patch) | |
tree | 42a2fc685ad242b2cb134a16b79564497c1a523f /app | |
parent | d10ecacc47c1bb640621eef620eb3099ca81f0da (diff) | |
parent | 1cf1e7bedbddc326d2551e984d6bac8f1027ede8 (diff) | |
download | gitlab-ce-04d1128b8a32022d4eb68694c007245936620b39.tar.gz |
Merge branch 'less-chatty-hipchat-intergation' into 'master'
Less chatty HipChat intergation
The HipChat integration is noisy. In our team it constantly overwhelms the channel with a lot of commits or the bodies of their messages. It's very easy to loose the actual conversation in the midst of this.
This request does two things:
* Limit the number of shown commits on every push
* Display only the first line (the subject) of each commit messages
We tried it and found it was nicer for us :smile:
See merge request !159
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project_services/hipchat_service.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb index 9c6fe7dab21..48fe365760b 100644 --- a/app/models/project_services/hipchat_service.rb +++ b/app/models/project_services/hipchat_service.rb @@ -18,6 +18,8 @@ # class HipchatService < Service + MAX_COMMITS = 3 + validates :token, presence: true, if: :activated? def title @@ -64,8 +66,13 @@ class HipchatService < Service message << "pushed to branch <a href=\"#{project.web_url}/commits/#{ref}\">#{ref}</a> " message << "of <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> " message << "(<a href=\"#{project.web_url}/compare/#{before}...#{after}\">Compare changes</a>)" - for commit in push[:commits] do - message << "<br /> - #{commit[:message]} (<a href=\"#{commit[:url]}\">#{commit[:id][0..5]}</a>)" + + push[:commits].take(MAX_COMMITS).each do |commit| + message << "<br /> - #{commit[:message].lines.first} (<a href=\"#{commit[:url]}\">#{commit[:id][0..5]}</a>)" + end + + if push[:commits].count > MAX_COMMITS + message << "<br />... #{push[:commits].count - MAX_COMMITS} more commits" end end |