Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae4c947

Browse files
committed
updated hipchat service to have quiet comments and labels
1 parent a61b614 commit ae4c947

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

docs/hipchat

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Note: HipChat has a new and improved integration with GitHub. While this
1+
Note: HipChat has a new and improved integration with GitHub. While this
22
service will continue to work, you really should check out the new integration.
33
Read more here: http://help.hipchat.com/knowledgebase/articles/64389-github-integration
44

@@ -21,5 +21,7 @@ Options
2121
2. **Quiet Fork** - Suppress the room notice if a project has been forked.
2222
3. **Quiet Watch** - Suppress the room notice that someone has started to watch the project.
2323
4. **Quiet Comments** - Suppress the room notice if a comment has been made on repo.
24-
5. **Quiet Wiki** - Suppress the room notice if a wiki item has been updated.
25-
6. **Active** - Turn On or Off the service hook.
24+
5. **Quiet Labels** - Suppress the room notice if an issue has had any label changes.
25+
6. **Quiet Assigning** - Suppress the room notice if an issue has been assigned or unassigned.
26+
7. **Quiet Wiki** - Suppress the room notice if a wiki item has been updated.
27+
8. **Active** - Turn On or Off the service hook.

lib/services/hipchat.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
class Service::HipChat < Service
22
password :auth_token
33
string :room, :restrict_to_branch, :color, :server
4-
boolean :notify, :quiet_fork, :quiet_watch, :quiet_comments, :quiet_wiki
4+
boolean :notify, :quiet_fork, :quiet_watch, :quiet_comments, :quiet_labels, :quiet_assigning, :quiet_wiki
55
white_list :room, :restrict_to_branch, :color
66

77
default_events :commit_comment, :download, :fork, :fork_apply, :gollum,
88
:issues, :issue_comment, :member, :public, :pull_request, :pull_request_review_comment,
9-
:push, :watch
9+
:push, :watch, :issue_label, :issue_unlabel, :issue_assign, :issue_unassign
1010

1111
def receive_event
1212
# make sure we have what we need
@@ -31,6 +31,8 @@ def receive_event
3131
return if event.to_s =~ /watch/ && data['quiet_watch']
3232
return if event.to_s =~ /comment/ && data['quiet_comments']
3333
return if event.to_s =~ /gollum/ && data['quiet_wiki']
34+
return if event.to_s =~ /label/ && data['quiet_labels']
35+
return if event.to_s =~ /assign/ && data['quiet_assigning']
3436

3537
http.headers['X-GitHub-Event'] = event.to_s
3638

test/hip_chat_test.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,36 @@ def test_quiet_comments_will_not_silence_other_events
7474
@stubs.verify_stubbed_calls
7575
end
7676

77+
def test_quiet_labels_silences_comment_events
78+
[:issue_labeled, :issue_unlabeled].each do |label_event|
79+
svc = service(label_event,
80+
default_data_plus('quiet_labels' => '1'), simple_payload )
81+
assert_nothing_raised { svc.receive_event }
82+
end
83+
end
84+
85+
def test_quiet_labels_will_not_silence_other_events
86+
stub_simple_post
87+
svc = service(default_data_plus('quiet_labels' => '1'), simple_payload)
88+
svc.receive_event
89+
@stubs.verify_stubbed_calls
90+
end
91+
92+
def test_quiet_assigned_silences_comment_events
93+
[:issue_assigned, :issue_unassigned].each do |assigned_event|
94+
svc = service(assigned_event,
95+
default_data_plus('quiet_assigning' => '1'), simple_payload )
96+
assert_nothing_raised { svc.receive_event }
97+
end
98+
end
99+
100+
def test_quiet_assigned_will_not_silence_other_events
101+
stub_simple_post
102+
svc = service(default_data_plus('quiet_assigning' => '1'), simple_payload)
103+
svc.receive_event
104+
@stubs.verify_stubbed_calls
105+
end
106+
77107
def test_quiet_wiki_silences_wiki_events
78108
svc = service(:gollum,
79109
default_data_plus('quiet_wiki' => '1'), simple_payload )

0 commit comments

Comments
 (0)