Skip to content

Commit 3a1a744

Browse files
committed
fixing a bug where subscribers would incorrectly mark something as unsupported
... even though another subscriber might support this
1 parent 3759847 commit 3a1a744

9 files changed

+7
-18
lines changed

src/Issues/GitHubRequestHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public function handle(Request $request)
8181

8282
$responseData = $event->getResponseData();
8383

84+
if (empty($responseData)) {
85+
$responseData['unsupported_action'] = $eventName;
86+
}
87+
8488
return $responseData;
8589
}
8690

src/Subscriber/AutoLabelPRFromContentSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ public function onPullRequest(GitHubEvent $event)
3636
{
3737
$data = $event->getData();
3838
if ('opened' !== $action = $data['action']) {
39-
$event->setResponseData(array('unsupported_action' => $action));
40-
4139
return;
4240
}
4341

src/Subscriber/BugLabelNewIssueSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public function onIssues(GitHubEvent $event)
3030
$data = $event->getData();
3131
$repository = $event->getRepository();
3232
if ('labeled' !== $action = $data['action']) {
33-
$event->setResponseData(array('unsupported_action' => $action));
34-
3533
return;
3634
}
3735

src/Subscriber/NeedsReviewNewPRSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public function onPullRequest(GitHubEvent $event)
2727
$data = $event->getData();
2828
$repository = $event->getRepository();
2929
if ('opened' !== $action = $data['action']) {
30-
$event->setResponseData(array('unsupported_action' => $action));
31-
3230
return;
3331
}
3432

src/Subscriber/StatusChangeByReviewSubscriber.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ public function onReview(GitHubEvent $event)
3333
{
3434
$data = $event->getData();
3535
if ('submitted' !== $data['action']) {
36-
$event->setResponseData(array('unsupported_action' => $data['action']));
37-
3836
return;
3937
}
4038

@@ -82,8 +80,6 @@ public function onReviewRequested(GithubEvent $event)
8280
{
8381
$data = $event->getData();
8482
if ('review_requested' !== $data['action']) {
85-
$event->setResponseData(array('unsupported_action' => $data['action']));
86-
8783
return;
8884
}
8985

src/Subscriber/StatusChangeOnPushSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public function onPullRequest(GitHubEvent $event)
2727
{
2828
$data = $event->getData();
2929
if ('synchronize' !== $data['action']) {
30-
$event->setResponseData(array('unsupported_action' => $data['action']));
31-
3230
return;
3331
}
3432

tests/Subscriber/BugLabelNewIssueSubscriberTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ public function testOnIssuesIgnoresNonLabeled()
153153

154154
$responseData = $event->getResponseData();
155155

156-
$this->assertCount(1, $responseData);
157-
$this->assertSame('close', $responseData['unsupported_action']);
156+
$this->assertEmpty($responseData);
158157
}
159158
}

tests/Subscriber/NeedsReviewNewPRSubscriberTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public function testOnPullRequestNotOpen()
6767

6868
$responseData = $event->getResponseData();
6969

70-
$this->assertCount(1, $responseData);
71-
$this->assertSame('close', $responseData['unsupported_action']);
70+
$this->assertEmpty($responseData);
7271
}
7372
}

tests/Subscriber/StatusChangeOnPushSubscriberTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ public function testOnNonPushPullRequestEvent()
9191

9292
$responseData = $event->getResponseData();
9393

94-
$this->assertCount(1, $responseData);
95-
$this->assertSame('labeled', $responseData['unsupported_action']);
94+
$this->assertEmpty($responseData);
9695
}
9796

9897
public function testWipPullRequest()

0 commit comments

Comments
 (0)