Skip to content
代码片段 群组 项目
提交 04d1128b 编辑于 作者: Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
浏览文件

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
No related branches found
No related tags found
无相关合并请求
......@@ -18,6 +18,8 @@
#
class HipchatService < Service
MAX_COMMITS = 3
validates :token, presence: true, if: :activated?
def title
......@@ -64,8 +66,13 @@ def create_message(push)
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
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册